Title: Drag and drop BETWEEN two treegrids (but not within) Post by: alastairwalker on August 19, 2014, 07:09:16 AM I have an application in which I need to be able to drag and drop BETWEEN two treegrids, but not permit drag and drop WITHIN either treegrid.
To explore this, I started off with the extension example (treegrid-dnd.zip), and extended it so that I have two treegrids (tg1, and tg2, using data1, and data2). (See the attached modified html script). Now, if I use $(function(){$('#tg1').treegrid({onDragEnter: function(targetRow,sourceRow){ var opts = $(this).treegrid('options'); var tr = opts.finder.getTr(this, targetRow[opts.idField]); if (tr.attr('node-id')){return false;}}})}); This disables tg1 from d and d'ing within Treegrid 1, but allows d and d into treegrid2. (This is expected behaviour) But if I add $(function(){$('#tg2').treegrid({onDragEnter: function(targetRow,sourceRow){ var opts = $(this).treegrid('options'); var tr = opts.finder.getTr(this, targetRow[opts.idField]); if (tr.attr('node-id')){return false;}}})}); Then d and d is not allowed either within each treegrid, or between the treegrids. So, clearly, there must be some parameter that is incorrect, but I am not smart enough in js to spot it yet. Any help on this will be really appreciated! Alastair |