Yes
I need to change sorting of groups that are rendering by groupingFunction, because they are sorted by alphabet, and sortingFunction method sort data inside each group
Is there any chance to be this feature implemented?
Yes this is an important feature for me too. Right now, it only sorts the groupings alphabetically, but I need to sort by some other data as well.
Any news on this?
+1 I am also looking forward for this important feature.
also would like to have this feature
You can do some magic to order your group ;-)
Add an "order" prefix to your group label, and remove it before displaying it.
this.groupingFunction = (item: ItemData) => {
return item.group.order + '@' + item.group.label;
};
<ng-template tkGroupTemplate let-category="category">
<StackLayout>
<Label [text]="category.split('@').splice(1).join('@')"></Label>
</StackLayout>
</ng-template>
Be careful, it's an alphabetical sort so ... '9' is greater than '80' ;-)
+1
I am also looking forward for this important feature, with Jonas Enhancement
I need to push a structured data in the groupTemplate
@sflament Please be aware, that the solution i suggest is for the Kirby designsystem and not intended for the ListView.
And the solution is not that well thought through. So please take that in to account 馃槃
Does anyone know if this feature is implemented?? Even I'm looking for sorting a group of list data items for my project.
Any updates on this feature?
static _MS_PER_DAY = 1000 * 60 * 60 * 24;
static maxDay = new Date(8640000000000000);
static utc2 = Date.UTC(BrowseComponent.maxDay.getFullYear(), BrowseComponent.maxDay.getMonth(), BrowseComponent.maxDay.getDate());
public static dateDiffInDays(a: Date): number {
// Discard the time and time-zone information.
const utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
return Math.floor((BrowseComponent.utc2 - utc1) / BrowseComponent._MS_PER_DAY);
}
public dateGroupingFunc(bravo: Bravo): string {
let date = new Date(bravo.created_at);
// https://angular.io/api/common/DatePipe
const prefix = `d${BrowseComponent.dateDiffInDays(date)}`;
console.log(prefix);
return `${prefix}@${formatDate(date, 'fullDate', 'en-US')}`;
}
my work-around for dates grouping. Thanks @jpierront for idea.
I really need this feature too! Any news?
getSortingString(title: string): string {
let data = "";
for (let i = 0; i < title.length; i++) {
data += String.fromCharCode(90 - parseInt(title.charAt(i), 10));
}
return data;
}
this.myGroupingFunc = (item) => {
const dt = new Date(item.created_at);
return this.getSortingString(formatDate(dt, "yyyyMMdd", this.locale)) + "@" + formatDate(dt, "dd-MM-yyyy", this.locale);
};
My workaround for sorting inside the group if you want to sort them by newest on top.
Using a prefix (thanks @jpierront ) generated based on year, month and day of the item. The prefix is converted to a string.
Thank you very much @jpierront and @Pandishpan 鉂わ笍
So. It will not be implemented. Could you please simply say that instead of leaving the community hanging? Or maybe you could say you accept PRs, and the community can help.
getSortingString(title: string): string { let data = ""; for (let i = 0; i < title.length; i++) { data += String.fromCharCode(90 - parseInt(title.charAt(i), 10)); } return data; } this.myGroupingFunc = (item) => { const dt = new Date(item.created_at); return this.getSortingString(formatDate(dt, "yyyyMMdd", this.locale)) + "@" + formatDate(dt, "dd-MM-yyyy", this.locale); };My workaround for sorting inside the group if you want to sort them by newest on top.
Using a prefix (thanks @jpierront ) generated based on year, month and day of the item. The prefix is converted to a string.
@Pandishpan Could you please explain the logic behind your solution? Or at least providing an inverse function to getSortingString would be helpful. Thanks.
Most helpful comment
Is there any chance to be this feature implemented?