Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default [3.3.0] Ext.grid.GridPanel -> enableDragDrop : true & CheckboxSelectionModel

    [3.3.0] Ext.grid.GridPanel -> enableDragDrop : true & CheckboxSelectionModel


    hi team,

    i just tried to combine a GridPanel with CheckboxSelectionModel and enableDragDrop and noticed, that nothing happens when you click on a checkbox as soon as enableDragDrop is set to true.

    to reproduce this, it is important to use the config:

    Code:
        var sm = new Ext.grid.CheckboxSelectionModel({
            checkOnly : true
        });
    with checkOnly : false, it works fine.

    for a testcase use examples/grid/grid-plugins.html

    and change grid-plugins.js:

    Code:
        ////////////////////////////////////////////////////////////////////////////////////////
        // Grid 2
        ////////////////////////////////////////////////////////////////////////////////////////
        var sm = new xg.CheckboxSelectionModel({
            checkOnly : true
        });
    
        var grid2 = new xg.GridPanel({
            enableDragDrop : true,
            store: new Ext.data.Store({
                reader: reader,
                data: xg.dummyData
            }),
            cm: new xg.ColumnModel({
                defaults: {
                    width: 120,
                    sortable: true
                },
                columns: [
                    sm,
                    {id:'company',header: "Company", width: 200, dataIndex: 'company'},
                    {header: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
                    {header: "Change", dataIndex: 'change'},
                    {header: "% Change", dataIndex: 'pctChange'},
                    {header: "Last Updated", width: 135, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
                ]
            }),
            sm: sm,
            columnLines: true,
            width:600,
            height:300,
            frame:true,
            title:'Framed with Checkbox Selection and Horizontal Scrolling',
            iconCls:'icon-grid',
            renderTo: document.body
        });
    best regards
    tobiu
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  2. #2
    Sencha User
    Join Date
    Mar 2010
    Posts
    47
    Vote Rating
    0
    Andrew Peacock is on a distinguished road

      0  

    Default


    Hi Tobias,

    Many thanks for sharing your solution - you've just saved me a lot of time searching!

    Regards,
    Andy

  3. #3
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    it would be nice if this issue could find its way into the bugtracker after 3 months


    best regards
    tobiu
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  4. #4
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    hi team,

    i needed a fast solution, so:

    Code:
    Ext.override(Ext.grid.GridDragZone, {
        getDragData : function(e){
            var t = Ext.lib.Event.getTarget(e);
            var rowIndex = this.view.findRowIndex(t);
            if(rowIndex !== false) {
                var sm = this.grid.selModel;
    
                if (sm instanceof(Ext.grid.CheckboxSelectionModel)) {
                    sm.onMouseDown(e, e.getTarget());
                }
    
                else if(!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;
        }
    });
    it would be nice, if this gets into svn.


    best regards
    tobiu
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  5. #5
    Sencha User j-joey's Avatar
    Join Date
    Apr 2008
    Location
    Mersin, Turkey
    Posts
    186
    Vote Rating
    0
    j-joey is on a distinguished road

      0  

    Default


    with this fix, it should behave completely natural

    PHP Code:
    Ext.overrideExt.grid.GridDragZone, {
        
    getDragData : function( ) {
            var 
    Ext.lib.Event.getTarget(e);
            var 
    rowIndex this.view.findRowIndex(t);
            if ( 
    rowIndex !== false ) {
                var 
    sm this.grid.selModel;

                if ( 
    sm instanceof( Ext.grid.CheckboxSelectionModel ) ) {
                    
    sm.onMouseDowne);
                }
                
                if( 
    t.className != 'x-grid3-row-checker' && ( !sm.isSelectedrowIndex ) || e.hasModifier() ) ) {
                    
    sm.handleMouseDownthis.gridrowIndex);
                }
                return { 
    gridthis.gridddelthis.ddelrowIndexrowIndexselections:sm.getSelections() };
            }
            return 
    false;
        }
    } ); 

  6. #6
    Sencha User
    Join Date
    Jul 2012
    Posts
    1
    Vote Rating
    0
    Golu is on a distinguished road

      0  

    Default


    Thanks tobiu. Thanks a lot. you have save my lot of time.


    Once again Thanks

  7. #7
    Ext JS Premium Member
    Join Date
    Apr 2008
    Posts
    352
    Vote Rating
    14
    rich02818 is on a distinguished road

      0  

    Default


    What is the bug number for this problem? It was reported 29 months ago.

Similar Threads

  1. set grid both enableDragDrop true and CheckboxSelectionModel false
    By Rooock in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 11 Jan 2010, 7:26 AM
  2. Replies: 4
    Last Post: 3 Sep 2009, 6:12 PM
  3. How to deselect a grid row when enableDragDrop is true
    By allpuser in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 24 Sep 2008, 11:08 PM

Thread Participants: 4