Hybrid View

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User mono blaine's Avatar
    Join Date
    Jul 2008
    Location
    Turkey
    Posts
    123
    Vote Rating
    8
    mono blaine will become famous soon enough

      0  

    Default [4.2.0.489] Grouping feature and DragDrop plugin on a Grid

    [4.2.0.489] Grouping feature and DragDrop plugin on a Grid


    When Ext.grid.feature.Grouping feature and Ext.grid.plugin.DragDrop plugin are used together on a grid, dragging a record into another group throws errors:

    Code:
    Uncaught RangeError: Maximum call stack size exceeded
    There's an infinite loop of method calls:

    Code:
    ...
    Ext.cmd.derive.setLastFocused
    Ext.cmd.derive.focusRow
    Ext.cmd.derive.onRowFocus
    Ext.cmd.derive.onLastFocusChanged
    ...
    Ext.cmd.derive.setLastFocused
    Ext.cmd.derive.focusRow
    Ext.cmd.derive.onRowFocus
    Ext.cmd.derive.onLastFocusChanged
    ...
    Sample code:

    Code:
    var store = Ext.create('Ext.data.Store', {
        storeId:'employeeStore',
        fields:['name', 'seniority', 'department'],
        groupField: 'department',
        data: {'employees':[
            { "name": "Michael Scott",  "seniority": 7, "department": "Management" },
            { "name": "Dwight Schrute", "seniority": 2, "department": "Sales" },
            { "name": "Jim Halpert",    "seniority": 3, "department": "Sales" },
            { "name": "Kevin Malone",   "seniority": 4, "department": "Accounting" },
            { "name": "Angela Martin",  "seniority": 5, "department": "Accounting" }
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'employees'
            }
        }
    });
    
    Ext.create('Ext.grid.Panel', {
        title: 'Employees',
        store: Ext.data.StoreManager.lookup('employeeStore'),
        columns: [
            { text: 'Name',     dataIndex: 'name' },
            { text: 'Seniority', dataIndex: 'seniority' }
        ],
        features: [{ftype:'grouping'}],
        viewConfig: {
            plugins: {
                ptype: 'gridviewdragdrop',
                dragText: 'Drag and drop to reorganize'
            }
        },
        width: 200,
        height: 275,
        renderTo: Ext.getBody()
    });

  2. #2
    Sencha User mono blaine's Avatar
    Join Date
    Jul 2008
    Location
    Turkey
    Posts
    123
    Vote Rating
    8
    mono blaine will become famous soon enough

      0  

    Default


    One approach is to look for groupers within the store, and override onNodeEnter of dropZone in order to invalidate such drops (from one group to another).

    edit: But it means that a record that belongs to the group X cannot be dragged into another grid that doesn't have any record that belongs to group X.

  3. #3
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    20
    makana has a spectacular aura about makana has a spectacular aura about

      1  

    Default


    I ran into the same problem.

    Probably not the best override, but this works for me:
    Code:
    Ext.define('Ext.override.grid.ViewDropZone', {
    	override: 'Ext.grid.ViewDropZone',
    	handleNodeDrop: function()
    	{
    		var sm = this.view.getSelectionModel(),
    			onLastFocusChanged = sm.onLastFocusChanged;
    
    		sm.onLastFocusChanged = Ext.emptyFn;
    		this.callParent(arguments);
    		sm.onLastFocusChanged = onLastFocusChanged;
    	}
    });
    Programming today is a race between software engineers striving to build bigger and better Ń–diot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)

    Enhanced ExtJS adapter for Adobe AIR

Thread Participants: 1