It's not practical for us to have the Selection APIs act differently for user interaction than when called by the Framework, as the behavior is wired in deeply.
Your best approach may be to temporarily enable the records that you want to be affected by selection changes - we'll update our documentation to address this.
Announcement
Collapse
No announcement yet.
X
-
Yes, the Selection API currently doesn't modify disabled records - we're discussing the matter and will update this thread if we make any changes.
Originally posted by SimonF View PostAlso I cannot enable a disabled Treenode through the API.
Leave a comment:
-
TreeGrid selection behaviour on disabled TreeNodes
Hi there,
I have some issue with the behaviour of the selection with selectionAppearance checkbox.
If I have a tree with multiple nodes (only some are enabled).
When clicking a enabled checkbox, the state switches. Clicking a disabled checkbox has no effect (as wished).
The problem is that even with the API I cannot deselect an disabled treenode.
Also I cannot enable a disabled Treenode through the API.
This is reproducable with the latest nightly SmartClient_v110p_2016-06-05_Pro and all current browsers.
There should be a possibility do select/deselect a disabled treenode.
A workaround would be to first store the enable-state in a variable, then do the activation etc, and then set the enable-state back to the treenode, but this should do the framework itself.
Code for reproduction:
Code:isc.TreeGrid.create({ "ID" : "theMainTree", "width" : "100%", "height" : "100%", "canEdit" : true, "showPartialSelection" : true, "selectionProperty" : "isSelected", "selectionAppearance" : "checkbox", "canGroupBy" : false, "canSort" : false, "showSelectedStyle" : false, "fields" : [{ "name" : "titleField", "title" : "title", "type" : "text" } ], data : isc.Tree.create({ "modelType" : "children", "openProperty" : "isOpen", "root" : { "title" : "Root", "id" : "3", "children" : [{ "title" : "", "isFolder" : false, "isOpen" : false, "id" : "1", "isSelected" : true, enabled : true, "titleField" : "enabled and checked" }, { "title" : "", "isFolder" : false, "isOpen" : false, "id" : "2", "isSelected" : false, enabled : false, "titleField" : "disabled" }, { "title" : "", "isFolder" : false, "isOpen" : false, "id" : "3", enabled : true, "isSelected" : false, "titleField" : "enabled" }, { "title" : "", "isFolder" : false, "isOpen" : false, "id" : "4", "isSelected" : true, enabled : false, "titleField" : "disabled and checked" } ] } }) }); isc.Button.create({ left : 20, top : 150, "action" : function () { var selectedRecords = []; var selectedIds = [1, 2, 3, 4]; for (i = 0; i < selectedIds.length; i++) { selectedRecords.push(theMainTree.data.find("id", selectedIds[i])); } theMainTree.deselectAllRecords(); theMainTree.selectRecords(selectedRecords); }, width : 200, "title" : 'select all' }); isc.Button.create({ left : 20, top : 170, "action" : function () { theMainTree.deselectAllRecords(); }, width : 200, "title" : 'deselect all' }); isc.Button.create({ left : 20, top : 190, "action" : function () { var selectedIds = [1, 2, 3, 4]; for (i = 0; i < selectedIds.length; i++) { record = theMainTree.data.find("id", selectedIds[i]); record.enabled = !record.enabled; } theMainTree.data.dataChanged(); }, width : 200, "title" : 'switch disable' });
Tags: None
Leave a comment: