PDA

View Full Version : GroupingStore



micgala
21 Dec 2009, 7:54 AM
Hi.

I am using GroupingStore, and I have noticed a behaviour that may be wrong (noticed it since 2.0).

In the GroupintStore class, groupBy method, we have this:



if (se.getSortField() != null && !se.getSortField().equals(field)) {
applySort(false);
} else {
sortData(field, null);
}


I have one case, hard to extract for a test case, where se.getSortField is null, but se.getSortDir is not null.

So I have extended the GroupingStore like this:



if (se.getSortField() != null && !se.getSortField().equals(field)) {
applySort(false);
} else {
//Using sortDir instead of null
sortData(field, se.getSortDir());
}


Question is: shouldn't this be default behaviour?

GXT should first try to use getSortDir instead of using null there.... shouldn't it?

sven
21 Dec 2009, 7:58 AM
There is no bug. It works as expected. If you want custom behaviour, you will need to extend GroupingStore.

micgala
21 Dec 2009, 8:00 AM
Can you explain me why you are using null, instead of se.getSortDir?

sven
21 Dec 2009, 8:17 AM
Because the sort dir is for sorting, and not for grouping. Maybe we can add some GroupDir for a feature release.