]>
git.proxmox.com Git - extjs.git/blob - extjs/classic/classic/src/grid/ViewDropZone.js
4 Ext
.define('Ext.grid.ViewDropZone', {
5 extend
: 'Ext.view.DropZone',
7 indicatorHtml
: '<div class="' + Ext
.baseCSSPrefix
+ 'grid-drop-indicator-left" role="presentation"></div><div class="' + Ext
.baseCSSPrefix
+ 'grid-drop-indicator-right" role="presentation"></div>',
8 indicatorCls
: Ext
.baseCSSPrefix
+ 'grid-drop-indicator',
10 handleNodeDrop : function(data
, record
, position
) {
12 store
= view
.getStore(),
13 index
, records
, i
, len
;
15 // If the copy flag is set, create a copy of the models
17 records
= data
.records
;
19 for (i
= 0, len
= records
.length
; i
< len
; i
++) {
20 data
.records
.push(records
[i
].copy());
24 * Remove from the source store. We do this regardless of whether the store
25 * is the same bacsue the store currently doesn't handle moving records
26 * within the store. In the future it should be possible to do this.
27 * Here was pass the isMove parameter if we're moving to the same view.
29 data
.view
.store
.remove(data
.records
, data
.view
=== view
);
32 if (record
&& position
) {
33 index
= store
.indexOf(record
);
35 // 'after', or undefined (meaning a drop at index -1 on an empty View)...
36 if (position
!== 'before') {
39 store
.insert(index
, data
.records
);
41 // No position specified - append.
43 store
.add(data
.records
);
46 // Select the dropped nodes
47 view
.getSelectionModel().select(data
.records
);
49 // Focus the first dropped node.
50 view
.getNavigationModel().setPosition(data
.records
[0]);