jQWidgets Forums

jQuery UI Widgets Forums Grid changing a row's group

This topic contains 2 replies, has 2 voices, and was last updated by  mrallaris 10 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • changing a row's group #59668

    mrallaris
    Participant

    Hello – first let me say that I LOVE jqWidgets … thank you so much for this!

    I have a jqxGrid with grouping. I have hidden the column that the groups are based on. I would like the users to be able to dynamically assign rows to groups (and create new groups). The grid has a buttons column with a button that allows the user to assign the row to a group.

    My problem is getting that row to move to the group once the group is selected. When the user selects the group I updated the cell value of the hidden column field to the new group name. I was hoping that would do the trick but no luck. Then I tried calling the grid’s refresh method and that didn’t work. I also tried calling the grid’s render method but also no luck. I can confirm that the group cell value gets updated, I just don’t know how to get the grid to move that row to the new group.

    There’s much code worth displaying here. The hidden column that the grouping is based on is called “groupBy”. Here are the functions that allow the user to change the row’s group via a jqxWindow. The group name is entered into a textbox (selectGroupInput) and the grid’s row number is stored in a hidden textbox (selectGroupRowHidden).

    
    function openSelectGroup(row, groupName)
    {
    	$("#selectGroupInput").val(groupName);
    	$("#selectGroupRowHidden").val(row);
    	$('#selectGroupWindow').jqxWindow('open');
    }
    
    function selectGroupOK()
    {
    	$('#selectGroupWindow').jqxWindow('close');
    	$("#bomtable").jqxGrid('setcellvalue', $("#selectGroupRowHidden").val(), 'groupBy', $("#selectGroupInput").val());
    	$("#bomtable").jqxGrid('render');
    }
    

    Thank you for your help!

    changing a row's group #59678

    Dimitar
    Participant

    Hello mrallaris,

    Instead of render, please try calling the methods cleargroups and addgroup consecutively, i.e.:

    function selectGroupOK()
    {
    	$('#selectGroupWindow').jqxWindow('close');
    	$("#bomtable").jqxGrid('setcellvalue', $("#selectGroupRowHidden").val(), 'groupBy', $("#selectGroupInput").val());
            $('#bomtable').jqxGrid('cleargroups');
            $('#bomtable').jqxGrid('addgroup', 'groupBy');
    }

    Best Regards,
    Dimitar

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

    changing a row's group #59708

    mrallaris
    Participant

    Works like a charm! Thanks so much.

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

You must be logged in to reply to this topic.