View Full Version : [gridviewdragdrop + checkboxmodel] do not want item be selected when drag and drop

26 Aug 2013, 12:19 AM
I modified the example code provided in this page
to checkbox model, I want the state of the item being dragged remains unchange, it is now forced to change to 'selected'.
If possible, I also do not want other highlighted items being rearranged when the current dragging item dropped.
Here is the code (modified from the given example):

/*global Ext:false */Ext.onReady(function () {
Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields: ['name'],
data: [
proxy: {
type: 'memory',
reader: 'array'

Ext.create('Ext.grid.Panel', {
store: 'simpsonsStore',
selModel: {mode: 'SIMPLE'}, //added
selType: 'checkboxmodel', //added
columns: [{
header: 'Name',
dataIndex: 'name',
flex: true
viewConfig: {
plugins: {
ptype: 'gridviewdragdrop',
dragText: 'Drag and drop to reorganize'
height: 200,
width: 400,
renderTo: Ext.getBody()

Thanks! ~o)

Gary Schlosberg
30 Aug 2013, 1:50 PM
Hopefully you can listen for the beforeselect (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.selection.CheckboxModel-event-beforeselect) event on the checkboxmodel and do something differently, because the beforedrop (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.plugin.DragDrop-event-beforedrop) event on the gridview seems like it would happen too late. I set the checkOnly to true, allowing a place to click that doesn't select the checkbox, but as you've seen, it selects it as soon as one holds the click to initiate the drag.