jQuery UI Widgets Forums TreeGrid Getting TreeGrid to Refresh from Server

This topic contains 5 replies, has 4 voices, and was last updated by  Hendrick 8 years, 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Getting TreeGrid to Refresh from Server #50328

    David
    Participant

    Hi,

    I am having difficulty figuring out the proper way to get TreeGrid to refresh its data from the server. I’m using “virtual mode (load on demand)” to populate each level of the tree with a separate JSON ajax call, and it is working.

    However, when trying to force a refresh of some or all of the data, I’ve found that calling $(“#jqxtreegrid”).jqxTreeGrid(“updatebounddata”) does not seem to do anything, including making any network calls (this call does refresh from the server when using the Grid component in a similar way).

    After some trial and error, I’ve found that if I save a reference to the jqxDataAdapter and call dataAdapter.dataBind(), it will refresh (only) the most recent node whose data was fetched from the server, which is not generally useful. I would like to be able to do one or both of these:

    * Tell TreeGrid to refresh the entire tree.
    * Tell TreeGrid to refresh a specific node.

    It already sort-of does the second of these, but I haven’t figured out how to specify the node that should be refreshed.


    Peter Stoev
    Keymaster

    Hi David S,

    You are trying to do something which is not possible with jqxTreeGrid. When you load a recordon demand, you can update it only by using “updateRow” method or “setCellValue” method.

    Best Regards,
    Peter Stoev

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

    Getting TreeGrid to Refresh from Server #60397

    jbpd
    Participant

    Has this been addressed in any new releases or is possibly going to be getting included in any future releases? This would be extremely helpful to have. Thanks!

    Getting TreeGrid to Refresh from Server #60402

    Peter Stoev
    Keymaster

    Hi jbpd,

    There is no issue here to be addressed. If you want to update a cell or row, use “setCellValue” or “updateRow” methods.

    Best Regards,
    Peter Stoev

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


    Hendrick
    Participant

    Hi jbpd,

    This worked for me, I created a refresh node function, requires you to pass the row as a parameter.
    function refreshSingleNode(selectedrow)
    {
    if (selectedrow.records)
    {
    for (var i = 0; i < selectedrow.records.length; i++) {
    $(“#treeGrid”).jqxTreeGrid(‘deleteRow’, selectedrow.records[i].id)
    }
    }
    $(“#treeGrid”).jqxTreeGrid(“collapseRow”,selectedrow.id);
    $(“#treeGrid”).jqxTreeGrid(‘beginUpdate’);
    rows[0].expanded = false;
    rows[0]._loadedOnDemand = false;
    rows[0].leaf = false;
    $(“#treeGrid”).jqxTreeGrid(‘updateRow’, selectedrow.id,selectedrow)
    $(“#treeGrid”).jqxTreeGrid(‘endUpdate’);

    $(“#treeGrid”).jqxTreeGrid(“expandRow”, selectedrow.id);

    }


    Hendrick
    Participant

    UPDATED Method

    function refreshSingleNodebyparent(nodeId)
    {

    var row = $(“#treeGrid”).jqxTreeGrid(‘getRow’, nodeId);

    if (row.records)
    {
    var listArray = new Array();
    for (var i = 0; i < row.records.length; i++) {
    listArray.push(row.records[i].id);

    }

    for (var z = 0; z < listArray.length; z++) {

    $(“#treeGrid”).jqxTreeGrid(‘deleteRow’, listArray[z])
    }

    }

    $(“#treeGrid”).jqxTreeGrid(“collapseRow”, row.id);

    $(“#treeGrid”).jqxTreeGrid(‘beginUpdate’);
    row.records = [];
    row.expanded = false;
    row._loadedOnDemand = false;
    row.leaf = false;
    $(“#treeGrid”).jqxTreeGrid(‘updateRow’, row.id, row)
    $(“#treeGrid”).jqxTreeGrid(‘endUpdate’);

    $(“#treeGrid”).jqxTreeGrid(“expandRow”, row.id);

    }

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

You must be logged in to reply to this topic.