Cannot Order Groupings

QuestionsCannot Order Groupings
Greg asked 9 years ago

Hi,

I have enabled grouping on a grid which groups my dates by week number, so data looks like this;

Week #1
– Jan 12, 2016
– Jan 20, 2016

Week #37
– Sept 9, 2015
– Sept 11, 2015

However, I want the date (and as a result the groupings) to sort by the actual date. I.e., the data should look like this;

Week #37
– Sept 9, 2015
– Sept 11, 2015

Week #1
– Jan 12, 2016
– Jan 20, 2016

I have tried playing around with the sort order on the grid and in the grouping and this does not change. I have even tried creating a custom column that could be manually toggled to set the DISPLAY ORDER but this does not work either.

How do I get the grid to sort the groupings correctly, instead of just by the Week #.

Thank you – Greg

1 Answers
Abu Ghufran answered 9 years ago

For week descending sort, you need to set it in grouping options.

$grid["groupingView"]["groupOrder"] = array("desc"); // show group in asc or desc order
$grid["groupingView"]["groupDataSorted"] = array(true); // show sorted data within group

To make date sort ascending, you can

$grid["sortname"] = 'invdate'; // by default sort grid by this field
$grid["sortorder"] = "asc"; // ASC or DESC

Your Answer

17 + 2 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?