X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/src/grid/ViewDropZone.js diff --git a/src/grid/ViewDropZone.js b/src/grid/ViewDropZone.js new file mode 100644 index 00000000..a15a5962 --- /dev/null +++ b/src/grid/ViewDropZone.js @@ -0,0 +1,36 @@ +Ext.define('Ext.grid.ViewDropZone', { + extend: 'Ext.view.DropZone', + + indicatorHtml: '
', + indicatorCls: 'x-grid-drop-indicator', + + handleNodeDrop : function(data, record, position) { + var view = this.view, + store = view.getStore(), + index, records, i, len; + + // If the copy flag is set, create a copy of the Models with the same IDs + if (data.copy) { + records = data.records; + data.records = []; + for (i = 0, len = records.length; i < len; i++) { + data.records.push(records[i].copy(records[i].getId())); + } + } else { + /* + * Remove from the source store. We do this regardless of whether the store + * is the same bacsue the store currently doesn't handle moving records + * within the store. In the future it should be possible to do this. + * Here was pass the isMove parameter if we're moving to the same view. + */ + data.view.store.remove(data.records, data.view === view); + } + + index = store.indexOf(record); + if (position == 'after') { + index++; + } + store.insert(index, data.records); + view.getSelectionModel().select(data.records); + } +}); \ No newline at end of file