Ext is a great javascript library but ofcourse there are times where some things doesn't work and one of them is the rowdblclick and rowclick listener. Here is how i fixed it when i've encountered this problem.
As you can see instead of doing
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
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
Hey men!!!! Works perfect!!!
ReplyDeletegrid.on("rowdblclick",function(grid,row){ alert('dblclick'); });
Thanks!!!!