PDA

View Full Version : getSelectedRecords, getSelectionCount in List



venkatadineshp
27 Jul 2011, 9:51 AM
Hi,

I am using a list which is populated with contents in a store. I want to pass the index of selected row or record to different panel. I tried to get the index or the current record of selection using getSelectedRecords, getSelectionCount methods. But I always end up getting 0 (zero) for getSelectionCount and '[]' in case I use getSelectedRecords. Can any one please help me with this.


Trial.views.ResultsList = new Ext.List({
id : 'resultsList',
store : Trial.resultsDataStore,
itemTpl :'<div class="list-item-Source">{originCity}</div>'
+ '<div class="list-item-Destination">{destinationCity}</div>',
onItemDisclosure:function(thisComponent){
// Trial.SelectedRecordNumber = this.getSelectionCount();
console.log(this.getSelectedRecords());
Trial.views.viewport.setActiveItem(Ext.getCmp('resultDetailsPanel'));
}
});

Thanks

won.rhee
2 Aug 2011, 4:12 PM
You can simply do this :



Trial.views.ResultsList = new Ext.List({
id : 'resultsList',
store : Trial.resultsDataStore,
itemTpl :'<div class="list-item-Source">{originCity}</div>'
+ '<div class="list-item-Destination">{destinationCity}</div>',
onItemDisclosure:function(thisComponent){

console.log(thisComponent.data);

}
});