jQWidgets Forums

jQuery UI Widgets Forums Grid Get Group Index From Selected Row

This topic contains 1 reply, has 2 voices, and was last updated by  svetoslav_borislavov 3 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Get Group Index From Selected Row #121877

    matthew.greenwood
    Participant

    Is it possible to get the group index of a selected row? I know from other posts that adding or deleting a row causes the groups to collapse, as the grid gets re-rendered. Therefore I was hoping to be able to get the group index of the row to be deleted and then once it has been deleted use that index id to re-expand the correct group.

    Get Group Index From Selected Row #121882

    Hi Matthew,

    Here is an example of getting the group`s index:

    $(‘#jqxgrid’).on(‘rowselect’, function (event) {
    var args = event.args;

    const index = getIndexOfGroupBySelectedRow(args);
    //Assign the index to a variable
    });

    function getIndexOfGroupBySelectedRow(rowArgs) {
    console.log(row);
    const groupsCount = $(‘#jqxgrid’).jqxGrid(‘getrootgroupscount’);

    let groupIndex = -1;

    for (let i = 0; i < groupsCount; i++) {

    const currentGroupName = $(‘#jqxgrid’).jqxGrid(‘getgroup’, i).group;

    const rowData = rowArgs.row;

    for (const key in rowData) {

    groupIndex = i;
    }
    }
    }

    Please feel free to contact me if you need any further information!

    Best regards,
    Svetoslav Borislavov
    jQWidgets Team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.