Forum Discussion

gyanianand's avatar
gyanianand
Cloud Apps
05-15-2023
Solved

Reorder columns in pivot table

Hi Team,@Angelina_QBeeQ I want to order the weeks displayed in below pivot in desc order i.e latest week first and so on. Also how to hide the "Header" word....i need the column but the column head...
  • Angelina_QBeeQ's avatar
    05-16-2023

    Hi gyanianand ,
    If you want to reorder rows/columns, use the script below:

    widget.on('buildquery', function (se, ev) {
    	ev.query.metadata[3].jaql["sort"] = "desc"; // [3] add here the index of your query
    });

    The sample with result and query index here:

    To hide the column header, you can change the cell value:

    widget.transformPivot(
    	{},
      function (metadata, cell) {
        if (metadata.colIndex == 0 && metadata.rowIndex == 0) {
          cell.content = ' '
        }
      }
    );

    Always here to help,
    Angelina from QBeeQ
    [email protected]
    QBeeQ  - Gold Implementation and Development Partner