Charles Plager
Charles Plager

Reputation: 604

Update JQXTreeGrid without having all rows collapse

I have a JQX Tree Grid that I am updating from a stream.

The update works, but the tree grid is completely collapsed after the update. I would like the grid to stay expanded as it was.

I am calling .jqxTreeGrid('updateBoundData') at the end of the update.

I have tried combinations of beginUpdate/endUpdate and refresh; these did not update the grid.

function updatetreegrid(msg) {
        
    // UpdateId in message should be the column to use
    let { GridName, UpdateId, Rows } = msg;

    for (let i = 0; i < Rows.length; i++) {
        let row = Rows[i];

        let doDelete = row.IsEmpty === 'DELETE';
        let found = eval("data"+GridName+".findIndex(d => d['"+UpdateId+"'] == row[UpdateId])");

        if (doDelete) {
            if (found >= 0) {
                eval("data"+GridName+".splice(found, 1);");
            }
        }
        else {
            if (found == -1) {
                eval("data"+GridName+".push(row)");
            }
            else {
                eval("data"+GridName+"[found] = row");
            }
        }
    }
    //$("#grid"+GridName).jqxTreeGrid('beginUpdate');
    //$("#grid"+GridName).jqxTreeGrid('endUpdate');
    //$("#grid"+GridName).jqxTreeGrid('refresh');
    $("#grid"+GridName).jqxTreeGrid('updateBoundData');
    
}
    

Is there a different update command that won't collapse all of the rows? Is it possible to ask which rows are expanded and re-apply it after the update (not great, but better than nothing).

Thanks!

Upvotes: 0

Views: 73

Answers (1)

Charles Plager
Charles Plager

Reputation: 604

According to the good folks at JQWidgets, this is not yet possible:

We are aware of this limitation of the TreeGrid. This currently makes a re-render and the state is lost. We created a work item to update this for the next version of the TreeGrid.

Upvotes: 0

Related Questions