Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    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.


    Click image for larger version

Name:	Animation 49.gif
Views:	66
Size:	550.0 KB
ID:	238455
    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'
    });
    Best regards

    #2
    Hi,
    is there any response to this?
    Regards

    Comment


      #3
      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 Post
      Also I cannot enable a disabled Treenode through the API.
      What API are you referring to? If you want to enable or disable a particular record, you can directly set its "enabled" property (customizable through ListGrid.recordEnableProperty), and then call ListGrid.refreshRow() on the particular row associated with that record. (You can call ListGrid.getRecordIndex() if needed.)

      Comment


        #4
        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.

        Comment

        Working...
        X