jQWidgets Forums

jQuery UI Widgets Forums Grid Make "total row" unsortable in GridView

This topic contains 6 replies, has 2 voices, and was last updated by  blinkins0n 13 years ago.

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

  • blinkins0n
    Member

    Hi,

    I’m trying to build my own “total row” in the footer of the grid.

    The only issue I have is that “total row” is being sorted when clicking the head of the sortable column.

    Any idea how to make that last row unsortable to keep it fixed?

    Thanks very much!


    Peter Stoev
    Keymaster

    Hi blinkins0n,

    My suggestion is to add a DIV tag below the Grid’s DIV and style it like a Grid row(of course if you are not using the Grid in paging mode). Otherwise, it is not possible to disable the sorting or filtering of a specific Row. Another possible solution is to subscribe to the appropriate events for sorting and filtering and add/remove the totals row.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    blinkins0n
    Member

    I’m still working with a totals row for the grid and I’m having trouble sorting.

    I have a TotalsRow. When I sort the grid I remove the TotalsRow in the bind.(“sort”) event. I now want to re-add the row when the bind.(“sort”) is complete.

    What grid event could be used to add the row when sorting is finished?

    Thanks.


    Peter Stoev
    Keymaster

    Hi blinkins0n,

    Actually, the Grid is refreshed before the ‘sort’ event is raised as the event is called at the last line of the Grid’s ‘sortby’ method. If you however, use custom Sort function or server side sorting and your data is loaded through ajax, then you can use the dataAdapter’s loadComplete callback function which is called when the data from the server is downloaded and loaded into the Grid. I think that the loadComplete function would be appropriate for adding the totals row.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    blinkins0n
    Member

    Hi Peter,

    I am not using custom or server side sorting.

    I load the grid through an ajax call. This dataset already has a totals row. When I sort on a column I call

    var totalsrow;
    $(“#jqxgrid”).bind(“sort”, function (event) {
    totalsrow = $(“#jqxgrid”).jqxGrid(‘getrowdata’, lasrow);
    $(“#jqxgrid”).jqxGrid(‘deleterow’, lasrow);
    });

    I am looking for a way to add the row once the sort is complete and the grid has refreshed.

    $(“#jqxgrid”).jqxGrid(‘addrow’, null, totalrow, ‘last’);

    Is this possible?

    Thanks


    Peter Stoev
    Keymaster

    Hi blinkins0n,

    Unfortunately, I can’t provide you a workaround in your scenario with the current API of the Grid. We’ll need to extend it in the next version or you may try the approach that I suggested you previously – delete the totals row after binding the Grid and then add a DIV tag below the Grid’s DIV and style it like a Grid row. Fill the new DIV tag’s cells with the values from the totals row. In addition, a built-in Grid aggregates feature is planned for the second half of July.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    blinkins0n
    Member

    No problem.

    Thanks for your quick reply. Looking forward to the next release.

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

You must be logged in to reply to this topic.