PDA

View Full Version : How to delete multiple objects whose id='null' -EXTJS



tsensuous.grace
22 Jun 2016, 3:58 PM
I have list of objects whom I want to loop through to see for the value of a key, in this I want to remove objects whode id= "null". Below is snippet:


obj: {
after:{
id: null,
name:'test',
address: '63784hgj'
},
before:{
id: 678346,
name:'test',
address: '63784hgj'
},
single:{
id: null,
name:'test',
address: '63784hgj'
},
range:{
id: 65847,
name:'test',
address: '63784hgj'
}
}


I tried some sloppy way of doing this, considering I know the object that has id with null value:


obj.abc.id.destroy;
obj.abc3.id.destroy;


attached is the way the object is seen:


is there any way I could remove objects that dont have null values for their id's?

Gary Schlosberg
23 Jun 2016, 9:40 AM
If you're already iterating over the list of objects, can't you check each one for ids containing null values?