var grid = new Ext.grid.GridPanel({
store: <your datastore>,
columns:[<your columns>],
renderTo:'example-grid',
height:200,
listeners:{
rowdblclick : function(grid,row){
alert("rowdblclick")
},
rowclick:function(grid,row){
alert('rowclick')
}
}
});As you can see instead of doing
grid.getSelectionModel().addListener("click",
function(grid,row){ alert(''click'); })
or
grid.on("rowdblclick",function(grid,row){ alert('dblclick'); }); we added the listeners to the options when creating a new grid, there are disadvantage to this approach like when we need the listeners to be more dynamic but in case addListener and on doesn't work, try this approach.
Hope it helps
0 comments:
Post a Comment