PDA

View Full Version : [FIXED-591] Deleting of the selected tree nodes (MultiSelectionModel) causes Error



Qtx
17 Feb 2010, 11:32 AM
I am using MultiSelectionModel in the tree. In that case, deletion of the selected nodes causes the JavaScript Error



node.ui is null
if(node.ui.rendered){
If DefaultSelectionModel is used, all is OK.

Here, is the modified demo example for tree grid - tree-grid.js.


/*!
* Ext JS Library 3.1.1
* Copyright(c) 2006-2010 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
*/
Ext.onReady(function() {
Ext.QuickTips.init();

tree = new Ext.ux.tree.TreeGrid({
title: 'Core Team Projects',
width: 500,
height: 300,
renderTo: Ext.getBody(),
enableDD: true,
defaultSortable: false,
enableSort: false,

selModel: new Ext.tree.MultiSelectionModel(),

tbar: new Ext.Toolbar({
items: [
{
id: 'delete',
text: 'Delete Selected',

handler: function () {
var sm = tree.getSelectionModel();
var nodes = sm.getSelectedNodes();
for(var i = 0; i < nodes.length; i++)
{
nodes[i].remove(true);
}
}
}
]
}),

columns:[{
header: 'Task',
dataIndex: 'task',
width: 230
},{
header: 'Duration',
width: 100,
dataIndex: 'duration',
align: 'center',
sortType: 'asFloat',
tpl: new Ext.XTemplate('{duration:this.formatHours}', {
formatHours: function(v) {
if(v < 1) {
return Math.round(v * 60) + ' mins';
} else if (Math.floor(v) !== v) {
var min = v - Math.floor(v);
return Math.floor(v) + 'h ' + Math.round(min * 60) + 'm';
} else {
return v + ' hour' + (v === 1 ? '' : 's');
}
}
})
},{
header: 'Assigned To',
width: 150,
dataIndex: 'user'
}],

dataUrl: 'treegrid-data.json'
});
});

evant
6 Apr 2010, 4:11 AM
Although this behaviour isn't presenting itself anymore, there was another minor issue demonstrated by your test case. Namely, the selections array isn't copied.

Fixed in SVN, rev 6462.