3 hours ago, I asked a question in SO , about delete a part o an object that i liked this question to it.
delete a part of object in javascript
but now an other problem occurred when i delete from that array. I use that object to populate a FlexiGrid. but when i delete an item from that object by following code, instead of delete that item , it sets to undefined :( and flexigrid did not accept it for input data.
for (var i = 0; i < Roomdata.length; i++) {
if(Roomdata[i].id = X) {
delete Roomdata[i];
break;
}
}
for example , imaging i have 3 items in Roomdata like this :
{item1, item2, item3}
when call this code to delete item2 , Roomdata object is look like this :
{item1, undefined, item3}
and this is bad format to be acceptable by flexigrid as input data
It there any solution ?
thanks every body and sorry about my bad syntax(I am new in English)
regard , Foroughi
splice
. Why do you ask this question again? – Felix Kling Feb 20 '12 at 14:07