1

Here is the Example created - Pivot Table JSFiddle example: here

groupingView: {
        groupField: ['ComponentType'],
        groupColumnShow: [false],
        groupDataSorted: true,
        groupOrder: "desc"
    }, /*Is not working properly, when i click sort on ComponentType, group headers are not sorting*/

Need help to display ComponentType(group header) in desc order.

Thanks

Community
  • 1
  • 1
Mani Deep
  • 1,298
  • 2
  • 17
  • 33
  • Stackoverflow strictly recommend to avoid to include multiple questions in one post. The goal of stackoverflow in not helping you to solve all your problems. The goal is to *share with other people* the descriptions of common problems and the ways to solve the problems. Separate questions can be good indexed by searching engine and other people can easy find there. So please separate different questions in different posts. I posted below the answer on your first question only. The second question is absolutely independent from the first one and should be posted separately. – Oleg Apr 22 '15 at 09:50
  • @Oleg Thanks, i have removed 2nd question and posted it separetely – Mani Deep Apr 22 '15 at 10:05

1 Answers1

0

First of all you have to fix the grouping options options which you use. You have to use

groupOrder: ["desc"]

instead of

groupOrder: "desc"

The main problem with ignoring of "desc" grouping order exist already in old version of jqGrid (see the line of jqGrid 4.6 and the line of jqGrid 4.7).

I fixed the code in free jqGrid. The demo which uses the latest version of free jqGrid from GitHub don't have more the described problem: https://jsfiddle.net/OlegKi/bkqce0s0/11/

If you have to use old version of free jqGrid of jqGrid then you can solve the problem by changing datatype from "jsonstring" to "local":

onInitGrid: function () {
    var p = $(this).jqGrid("getGridParam"),
        userdata = p.datastr.userdata;

    // filter the data and remove some items
    p.data = $.grep(p.datastr, function (item) {
        return item.ComponentType !== "";
    });

    p.userData = userdata;
    p.datatype = "local";
}

The demo http://jsfiddle.net/OlegKi/bkqce0s0/12/

Oleg
  • 220,925
  • 34
  • 403
  • 798