PDA

View Full Version : Record set not working



mirkotus
5 Feb 2014, 10:36 PM
I use a groupping feature on my grid. When I click on a group I simply itterate throught my store and change some properties using set. But the attribute doesn't get set no mather what.. Here is my code:




onGroupClick(node, view, group){
var store = Ext.getStore('someStore');
store.data.each(function(item, index, totalItems ) {
if (item.data.id == somecondition ){
item.set('displayName', 'someName'); //DOES NOT WORK }
});
}

saJoshua
5 Feb 2014, 10:53 PM
Have you put breakpoints on the code? How far is it actually getting?

mirkotus
5 Feb 2014, 11:33 PM
The code executes fine without any errors. The loop goes throught all items and it looks like only the record.set line is causing problems. But it is a mystery why...

saJoshua
6 Feb 2014, 12:06 AM
does the following output anything to the console?


store.data.each(function(item, index, totalItems ) {
if (item.data.id == somecondition ){
console.log(item.get('displayName'));
}
});

Are you able to step into the record.set function and see where it's falling over?

saJoshua
6 Feb 2014, 12:07 AM
Possibly try logging the value to the console after you've called set, to confirm whether the value is being updated to the store..

If it's on the store, but not on the view, that might point to an "update" event not being fired or handled on the store.

Zinnia
6 Feb 2014, 12:13 AM
HI,

In place of below code

store.data.each (function(items, index, totalItems){
................
}


Use

store.each (function(items, index, totalItems){
.....................
}


Thanks
Zinnia

saJoshua
6 Feb 2014, 6:25 AM
Did you find the solution to your problem?