Hi.
You're right, it could be much easier.
I'll try to print my code properly and explain the results at the end.
Here's my panel and dataview file :
Code:
Ext.define('DAM.view.medias.panel.dataview.View',
{
extend : 'Ext.view.View',
xtype : 'dam-view-medias-panel-dataview-view',
mixins :
{
dragSelector: 'Ext.ux.DataView.DragSelector',
draggable : 'Ext.ux.DataView.Draggable'
},
initComponent: function()
{
this.store = Ext.create('DAM.store.DamMedias', {});
Ext.apply(this,
{
tpl :
[
'<tpl for=".">',
'<div class="thumb-wrap" id="media_{id}">',
'<div class="thumb">',
'<img src="<tpl if="source">{source.Thumbnails.taille1}</tpl>{thumb}" title="<tpl if="source">{source.Filename}</tpl>{filename}" width="150px" />',
'</div>',
'<div class="infos">',
'{name}',
'</div>',
'<div class="icons">',
'<input type="checkbox" name="dragselector[]" value="{id}" />',
'<span class="icon-pencil" action="edit"></span>',
'<span class="icon-magnifier" action="magnify"></span>',
'</div>',
'</div>',
'</tpl>',
'<div class="x-clear"></div>'
],
title : "bite",
multiSelect : true,
singleSelect : true,
autoScroll : true,
trackOver : true,
overItemCls : 'x-item-over',
itemSelector : 'div.thumb-wrap',
listeners :
{
selectionchange: function(dv, nodes )
{
var l = nodes.length,
s = l !== 1 ? 's' : '';
this.up('panel').setTitle('Simple DataView (' + l + ' item' + s + ' selected)');
}
}
});
this.mixins.dragSelector.init(this);
this.mixins.draggable.init(this,
{
ddConfig :
{
ddGroup: 'mediaDropGroup'
},
ghostTpl: [
'<tpl for=".">',
'<img src="{thumb}" />',
'<tpl if="xindex % 4 == 0"><br /></tpl>',
'</tpl>',
'<div class="count">',
'{[values.length]} images selected',
'<div>'
]
});
this.callParent();
}
});
Ext.define('DAM.view.medias.panel.Dataview',
{
extend : 'Ext.Panel',
xtype : 'dam-view-medias-panel-dataview',
requires:
[
'Ext.view.View',
'Ext.ux.DataView.DragSelector',
'DAM.view.medias.panel.Pagination'
],
initComponent: function()
{
Ext.apply(this,
{
layout :
{
type : 'fit'
},
items :
{
xtype : 'dam-view-medias-panel-dataview-view',
trackOver : true
},
dockedItems:
[
{
dock : 'bottom',
xtype : 'pagingtoolbar'
}
]
});
this.callParent();
}
});
Here's my store reload
Code:
store.load(
{
scope: this,
params:
{
type : type,
id : param.raw.id,
from_date : param.raw.from_date,
to_date : param.raw.to_date
},
callback: function(records, operation, success)
{
}
});
First load :
- the single click selector works
- the drag selector is visible
- the drag selector works
- the cmd+click does not work
More load :
- the single click selector works
- the drag selector is not visible
- the drag selector works
- the cmd+click does not work
If I destroy the dragSelector proxy, nothing works anymore