PDA

View Full Version : itemdblclick not working on 2nd page pagingtoolbar



stoneboys
29 Feb 2012, 3:02 AM
Hi all, What problems on my codes below? This my grid is working ok, I load store with pageSize = 10 & Use PagingToolbar , on first Pages : My listener ( itemdblclick ) is working, But I click To next Pages with PagingToolbar itemdblclick Not Working .
this error from firebug :


grid.getStore().getAt(record.index) is undefined


var rec = grid.getStore().getAt(record.index).get('Pin');

And this my grid code :


Ext.define('Model',{ extend: 'Ext.data.Model',
fields: [
{name: 'Pin'},

{name: 'Name'}

] });


//Store
var Store = Ext.create('Ext.data.Store',{ pageSize: 10,

remoteSort: true,

autoDestroy: true,

autoLoad: true,

storeId: 'Store',

model: Model,

proxy: new Ext.data.AjaxProxy({

type: 'jsonp',

url: 'application/reg/registration.php',

extraParams: { task: 'list' },

reader: { type: 'json', root: 'rows', totalProperty: 'results'}

}),

sorters: [{property: 'Pin', direction: 'ASC'}]

});



var TwoGrid = Ext.create('Ext.grid.Panel',{ id: 'TwoGrid',

border: false,

stripeRows: true,

store: Store,

plugins: [Ext.create('Ext.ux.grid.GridSearch',{

mode: 'remote',

width: 150

})],

bbar: new Ext.PagingToolbar({

store: Store,

displayInfo: true,

displayMsg: 'Displaying Patient {0} - {1} of {2}',

emptyMsg: 'No Patient to display'

}),

columns: [
{id: 'Clpin', text: 'PIN', width: 150, dataIndex: 'Pin' },

{id: 'CName', text: 'NAME', width: 150,dataIndex: 'Name'}
] ,
listeners: {

itemdblclick: function(grid, record, item, index, e, eOpts ) {

var rec = grid.getStore().getAt(record.index).get('Pin'); //error here when page on 2nd page and more...

Ext.MessageBox.alert('Clicked!',rec);

}}


});




Thanks for answer..

friend
29 Feb 2012, 4:33 AM
Try changing this line in your listener:


var rec = grid.getStore().getAt(record.index).get('Pin');

To This:


var rec = grid.getStore().getAt(index).get('Pin');