Jump to content

HowTo suspend change event when drop to a node on treeview


delagoutte

Recommended Posts

Hello,

I have a drag and drop functionality between a unidbgrid and a unitreeview.

 

For do that i,'m using this code :

on unidbgrid

function beforeInit(sender, config)
{
    config.enableColumnMove = true;
    config.viewConfig = 
      {
        plugins: 
          {
            ptype: 'gridviewdragdrop',
            dragGroup: 'MainGridDrag',
            dropGroup: 'UserTreeDrop'
          }
                     
        }
}

on treeview :

function beforeInit(sender, config)
{
  config.viewConfig= 
  {
    plugins: 
      {
        ptype: 'gridviewdragdrop',
        dragGroup: 'UserTreeDrop',
        dropGroup: 'MainGridDrag',
        enableDrag: false
      },
    listeners: 
      {
       beforedrop: function(node, data, overModel, dropPos, opts) {
        this.droppedRecords = data.records;
        data.records = [];
        },
      drop: 
        function(node, data, overModel, dropPos, opts) 
          {
            var SelectRec = '';
            Ext.iterate(this.droppedRecords, 
              function(record) 
              {
                if (SelectRec == '') 
                {SelectRec += record.get('id')}
                else 
                {SelectRec += '-'+record.get('id')};        
              });
              
          ajaxRequest(sender, "_ddrop", ["GridSel=" + SelectRec , "TreeSel=" + overModel.get('id')]);
          this.droppedRecords = undefined;
      }
    }
  }
} 

the functionality must working like outlook, i have records on unidbgrid that i  affect on directory(treeview node) with drag and drop functionality.

After when i click on node that is doing a filter on grid for having the record affected to this directory

 post-892-0-72919600-1461915036_thumb.png

 

My problem is when i drop record on treeview the onchange event is fired before drop event.

How to suspend event onchange when i'm using drag and drop ?

 

i'm trying 

sender.getSelectionModel().suspendEvents(true); on beforedrop

and

ajaxRequest(sender, "_ddrop", ["GridSel=" + SelectRec , "TreeSel=" + overModel.get('id')]);           sender.getSelectionModel().resumeEvents(); on drop
but it don't work. Any Idea ?
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...