We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15083
    • 697 Posts
    Hi there,

    Using modext for building a CMP.
    Question:
    If there any provision in MODext in MODx.grid for drag and drop re-ordering of rows?

    Thanks in advance,

    J
      • 15083
      • 697 Posts
      Still never got a fix for this problem.
      I tried adding this to the grid:
      ,enableDragDrop: true, // enable drag and drop of grid rows
                  viewConfig: {
                      emptyText: 'No items found',
                      sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
                      forceFit: true,
                      autoFill: true
                  }
              ,ddGroup:'my-grid' */
      


      When I do this I can slect the rows, but I cannot release to re-order them?
      I do not know how to define the droppable area as being "itself"
      Any ideas?
        • 15083
        • 697 Posts
        I've also added this as a listen for the drop action:

        ,listeners: {
        
                    "render": {
                        scope: this,
                        fn: function(grid) {
        
                            var ddrow = new Ext.dd.DropTarget(grid.getView().mainBody, {
                                ddGroup : 'mygrid-dd',
                                notifyDrop : function(dd, e, data){
        
                                    var sm = grid.getSelectionModel();
                                    var rows = sm.getSelections();
                                    var cindex = dd.getDragData(e).rowIndex;
                                    if (sm.hasSelection()) {
                                        for (i = 0; i < rows.length; i++) {
                                            store.remove(store.getById(rows[i].id));
                                            store.insert(cindex,rows[i]);
                                        }
                                        sm.selectRecords(rows);
                                    }
                                }
                            });
        
                       }
                   }
                }


        BUT IT DOES NOT WORK!!! ARG!!!
        Its like the drop area is never defined?
          • 4172
          • 5,888 Posts
          do you want to show us your complete grid?
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 17499 ☆ A M B ☆
            • 872 Posts
            You can get an example of how to implement DnD reorder at the following adress:
            http://www.vinylfox.com/getting-started-with-grid-drag-drop/