PDA

View Full Version : How does Row Selection Work on a GridPanel?



lukefowell89
15 Dec 2010, 9:08 AM
I am trying to fix a problem on a locking grid, but the normal row selection that you would expect to occur doesnt seem to be working. I have been trying to debug, but I cant seem to understand how Ext selects a row by default?

When I click on a row, what happens next? which event is first to be triggered etc.?

Can someone break this down to me?

lukefowell89
16 Dec 2010, 1:52 AM
I really need to know where to look, I dont understand why my current grid won't select on the locked column, although in my test code, it works fine. I think if I can see how a row is selected, what happens to call the methods that do that?

Please help

lukefowell89
16 Dec 2010, 7:44 AM
Ok, I have debugged quite far now and have found where my problem lies.

When you use "enableDragDrag: true" on a grid, it will set "this.dragZone" to a new instance of Ext.grid.GridDragZone.

GridDragZone extends from DragZone, who's constructor is called with the container element of "this.view.mainBody.dom". As I am using a locking tree grid, my grid is split over mainBody and lockedBody in the template. Therefore only a partial amount of the grid is being enabled for drag drop.


Ext.grid.GridDragZone = function(grid, config){
this.view = grid.getView();
Ext.grid.GridDragZone.superclass.constructor.call(this, this.view.mainBody.dom, config);
this.scroll = false;
this.grid = grid;
this.ddel = document.createElement('div');
this.ddel.className = 'x-grid-dd-wrap';
};


I am trying to figure out how I can pass both mainBody and lockedBody and have it handled. I have come to the conclusion that I need to extend GridDragDrop so I can do this. I just am not sure what would be the best way?

Please can I have some suggestions to how I would extend this so that when GridDragZone is created, the container/target element for the dragdrop is both view.mainBody.dom and view.lockedBody.dom?

Thanks