Because gridpanel defines dragging, the data row of the selected gridpanel cannot be canceled as the following extension: Ext. grid. RowSelectionModel. override ({// FIX: addedthisfunctionsoitcouldbeoverridedinCheckboxSe...
The data row of the selected gridpanel cannot be canceled because gridpanel defines dragging.
Perform the following extensions:
Ext. grid. RowSelectionModel. override (
{
// FIX: added this function so it cocould be overrided in CheckboxSelectionModel
HandleDDRowClick: function (grid, rowIndex, e)
{
If (e. button ===0 &&! E. shiftKey &&! E. ctrlKey ){
This. selectRow (rowIndex, false );
Grid. view. focusRow (rowIndex );
}
},
InitEvents: function ()
{
If (! This. grid. enableDragDrop &&! This. grid. enableDrag ){
This. grid. on ("rowmousedown", this. handleMouseDown, this );
} Else {// allow click to work like normal
// FIX: made this handler function overrideable
This. grid. on ("rowclick", this. handleDDRowClick, this );
}
This. rowNav = new Ext. KeyNav (this. grid. getGridEl (),{
"Up": function (e ){
If (! E. shiftKey ){
This. selectPrevious (e. shiftKey );
} Else if (this. last! = False & this. lastActive! = False ){
Var last = this. last;
This. selectRange (this. last, this. lastActive-1 );
This. grid. getView (). focusRow (this. lastActive );
If (last! = False ){
This. last = last;
}
} Else {
This. selectFirstRow ();
}
},
"Down": function (e ){
If (! E. shiftKey ){
This. selectNext (e. shiftKey );
} Else if (this. last! = False & this. lastActive! = False ){
Var last = this. last;
This. selectRange (this. last, this. lastActive + 1 );
This. grid. getView (). focusRow (this. lastActive );
If (last! = False ){
This. last = last;
}
} Else {
This. selectFirstRow ();
}
},
Scope: this
});
Var view = this. grid. view;
View. on ("refresh", this. onRefresh, this );
View. on ("rowupdated", this. onRowUpdated, this );
View. on ("rowremoved", this. onRemove, this );
}
});
Ext. grid. CheckboxSelectionModel. override (
{
// FIX: added this function to check if the click occured on the checkbox.
// If so, then this handler shoshould do nothing...
HandleDDRowClick: function (grid, rowIndex, e)
{
Var t = Ext. lib. Event. getTarget (e );
If (t. className! = "X-grid3-row-checker "){
Ext. grid. CheckboxSelectionModel. superclass. handleDDRowClick. apply (this, arguments );
}
}
});
Ext. grid. GridDragZone. override (
{
GetDragData: function (e)
{
Var t = Ext. lib. Event. getTarget (e );
Var rowIndex = this. view. findRowIndex (t );
If (rowIndex! = False ){
Var sm = this. grid. selModel;
// FIX: Added additional check (t. className! = "X-grid3-row-checker"). It may not
// Be beautiful solution but it solves my problem at the moment.
If (t. className! = "X-grid3-row-checker ")&&(! Sm. isSelected (rowIndex) | e. hasModifier ())){
Sm. handleMouseDown (this. grid, rowIndex, e );
}
Return {grid: this. grid, ddel: this. ddel, rowIndex: rowIndex, selections: sm. getSelections ()};
}
Return false;
}
});