PDA

View Full Version : Grouped List is returning wrong index of selected item.



Johnbran
9 Sep 2011, 8:03 PM
Hello,

I have a problem I can't sort out. I have a grouped list. The problem is the list is reporting the index of the selection that does not match the index of the data in the store. Here is an illustration...27990

I believe the problem is because the list is grouped. This is the first time I have used a grouped list, so I am not sure if I am responding to the item selection correctly. I have never had problems with lists before. Here is my code...


listeners: {
itemtap: function(list, index){
update_advertiser_template(list, index);




}}


and...

function update_advertiser_template(list, index){

var record=list.store.getAt(index);
tmpLogo=record.get('logo');
tmpName=record.get('name');
tmpDescription=record.get('description');
}




Thanks

gubarez
24 Oct 2011, 7:27 AM
I also had this problem. To solve it, put a sorter with the property you are grouping in a descending order... somethink like this



var store = new Ext.data.Store ({
model: 'Model',
data: data,
sorters: [
{
property: 'property',
direction: 'DESC'
}
],

getGroupString : function(record) {
return (record.get('property'));
}
})

mchev2
18 Jan 2012, 11:33 AM
I also had this problem. To solve it, put a sorter with the property you are grouping in a descending order... somethink like this



var store = new Ext.data.Store ({
model: 'Model',
data: data,
sorters: [
{
property: 'property',
direction: 'DESC'
}
],

getGroupString : function(record) {
return (record.get('property'));
}
})


Thanks! This worked.