Open objects in tree on double click + Multiselect


#1

Hi,

is there a good way to change default behavior of object tree that I could select an object or folder by clicking on it and opening would be done by double click?

I tried changing AdminBundle/Resources/public/js/pimcore/object/tree.js:

  • itemclick to itemdblclick
var treeNodeListeners = {
            'itemdblclick': this.onTreeNodeClick,

It kinda works but eg folders get collapsed on double click together with opening.

I also tried adding multiselect option to tree by adding below in the same file:

// objects
this.tree = Ext.create('pimcore.tree.Panel', {
            selModel : {
                mode : 'MULTI'
            },

This also seems to work and might be useful for drag and drop of multiple items.

How can I disable folder collapsing on double click?
Is there a better way of changing this functionality then changing/overriding this file?

Thanks a lot
Ivan


#2

I figured out the way to suppress folder collapsing/expanding on double click.
In the same file add toggleOnDblClick: false.

// objects
this.tree = Ext.create(‘pimcore.tree.Panel’, {
selModel : {
mode : ‘MULTI’
},
store: store,
region: “center”,
autoLoad: false,
iconCls: this.config.treeIconCls,
id: this.config.treeId,
title: this.config.treeTitle,
autoScroll: true,
animate: false,
rootVisible: true,
bufferedRenderer: false,
border: false,
listeners: this.getTreeNodeListeners(),
scrollable: true,
viewConfig: {
plugins: {
ptype: ‘treeviewdragdrop’,
appendOnly: false,
ddGroup: “element”,
scrollable: true
},
listeners: {
nodedragover: this.onTreeNodeOver.bind(this)
},
xtype: ‘pimcoretreeview’,
toggleOnDblClick: false
}