![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 93 Pomógł: 7 Dołączył: 6.09.2011 Skąd: Olsztyn Ostrzeżenie: (0%) ![]() ![]() |
Witam, otóż mam pewien problem, a mianowicie. Po wywołaniu w konsoli kodu:
Kod $('body').data(); dostaję coś takiego: Kod Object {averageData: Object} averageData: Object 8: Object average: 3.599 documents: Array[2] 0: Object 1: Object length: 2 __proto__: Array[0] selector: x.fn.x.init[1] __proto__: Object 9: Object average: 3.648 documents: Array[2] 0: Object 1: Object length: 2 __proto__: Array[0] selector: x.fn.x.init[1] __proto__: Object __proto__: Object __proto__: Object Problem polega na tym, że w momencie wywołania takiej linii: Kod $('body').data('average-data')[studentId]['documents'].splice(removeIndex, 0); podstawiając za studentId = 8, a pod removeIndex np 0, usuwany jest index=0 zarówno z tablicy o indexie 8 jak i o indexie 9... Czy ktoś z Was może mi powiedzieć co robię nie tak? Z góry dziękuję |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 717 Pomógł: 120 Dołączył: 18.04.2009 Ostrzeżenie: (0%) ![]() ![]() |
prawdopodbnie zle zainicjalizowales tablice (podaj kod w ktorym tworzysz tablice)
edit: aha, albo zla kolejnosc argumentow: https://developer.mozilla.org/en-US/docs/We...ts/Array/splice drugi argument to ile elementow ma byc usunietych, a ty wpisales 0 Ten post edytował PrinceOfPersia 15.01.2014, 21:34:04 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 10.10.2025 - 02:57 |