PDA

View Full Version : How to get the row number on drop event?



telo.tao.yang
26 Aug 2013, 6:38 AM
When drag from row 3 and then drop on row 5 in a grid, how can i get drop row number of 5? thanks.

Phil Guerrant
26 Aug 2013, 8:07 AM
If you're using the grid dragdrop plugin you can listen to the drop event (http://docs.sencha.com/extjs/#!/api/Ext.grid.plugin.DragDrop-event-drop) The first parameter to the handler will be a "node" you can pass the node to the grid view's indexOf() (http://docs.sencha.com/extjs/#!/api/Ext.grid.View-method-indexOf) method to get the row number.

telo.tao.yang
27 Aug 2013, 6:04 AM
Thanks for your help, and had resolved!


drop: function(node, data, overModel, dropPosition, eOpts){
var record = data.records[0],
rowIndex = me.getView().indexOf(record);
......