jQuery UI Widgets Forums TreeGrid selection.length doesn't return >1 for parent node

This topic contains 2 replies, has 2 voices, and was last updated by  jzhong 11 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • jzhong
    Participant

    deleteButton.click(function () {
    if (!deleteButton.jqxButton(‘disabled’)) {
    var selection = $(“#treeGrid”).jqxTreeGrid(‘getSelection’);
    alert(selection.length);
    if (selection.length > 1) {
    var keys = new Array();
    for (var i = 0; i < selection.length; i++) {
    keys.push($(“#treeGrid”).jqxTreeGrid(‘getKey’, selection[i]));
    }
    $(“#treeGrid”).jqxTreeGrid(‘deleteRow’, keys);
    }
    else {
    $(“#treeGrid”).jqxTreeGrid(‘deleteRow’, rowKey);
    }
    updateButtons(‘delete’);

    }
    });

    I was customizing the deleteRow function. After I debugged the error, I find out that selection.length is always 1 for any node. Is there anyway to overcome this issue?


    Peter Stoev
    Keymaster

    Hi jzhong,

    var selection = $(“#treeGrid”).jqxTreeGrid(‘getSelection’); returns the selected row keys. It is not related to any parent-child relationship and I don’t find an issue with that method.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    jzhong
    Participant

    Ok. I see. I thought selection.length>1 meant the node has children.

    Is there any API to retrieve the children keys of selected node? Thanks.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.