[SOLVED] Grouping and labels

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

[SOLVED] Grouping and labels

Post by PointsWell »

I have a series of instances of a BO

Each BO will have a relationship to a classification

BORecord has peer single to BOClassification

BOClassification has attributes
Code, and
Name

Examples might be

Code: Select all

Code Name
10   Home
20   Export
When I create the BORecord instances I then want to show them grouped in a query

I can use a short cut on the BORecord to put the Name of the Classification into the query and then group the query on that shortcut, however, the relevance for sorting is based on the Code number

The challenge is that if I group on the shortcut of the Classification Name, Export will come before Home (this simple example I could just reverse the search order, however the real world example has multiple codes and names and they are not sortable alphabetically in a meaningful way) Where possible I'd like to not expose the Code as it is not user meaningful,

I suppose I could put the code and Name into a text field and then sort on that but this is not desirable. Does anyone have any suggestion?
Last edited by PointsWell on Tue May 25, 2021 10:24 pm, edited 1 time in total.
himanshu
Posts: 722
Joined: Thu Jun 19, 2008 6:24 am
Location: India
Contact:

Re: Grouping and labels

Post by himanshu »

Hi,

Are you looking something similar as shown in below screenshot?
2021-03-27_13-40-05_aim_forum.jpg
2021-03-27_13-40-05_aim_forum.jpg (50.33 KiB) Viewed 3860 times
From,
Himanshu Jain


AwareIM Consultant (since version 4.0)
OS: Windows 10.0, Mac
DB: MYSQL, MSSQL
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Grouping and labels

Post by PointsWell »

Yes but the sort needs to be based on code

So

Code: Select all

Code Name
10   Home
20   Export
30   Special
99   Other
Simple grouping on the name would produce

Export
Home
Other
Special

Or
Special
Other
Home
Export

Whereas it needs to be
Home
Export
Special
Other
hpl123
Posts: 2579
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Grouping and labels

Post by hpl123 »

I have created a fix for this, it´s a hack but it works. It´s a long time since I actually did this so can´t recall 100% of the details. Here is some stuff from my implementation, see if it helps. The solution below works and is used in a live app and have worked for a long long time so is reliable and/but if anyone else has a smoother way of doing this directly in Kendo, that would of course be better (please share).

I have the group code generated via BS rules and then populated in the query initialization script via a tag and here is my exact script:

Code: Select all

GroupingCode=`var ds = config.dataSource;config.columns[9].groupHeaderTemplate='#= value # <span class=fpquerygroupcount>(#= count #)</span>';ds.group = [{field:'DeadlineDateGroup', dir: 'asc' ,aggregates: [ { field: 'DeadlineDateGroup', aggregate: 'count'}] }];ds.serverSorting=false;ds.sort={field: 'DeadlineDate', dir: 'asc'};` 
The DeadlineDateGroup attribute has different codes within them which is used in sorting (it´s the deadlinedategroup1 etc. that is doing the actual sorting and as it´s HTML, the span code etc. etc. is not shown in the frontend of the application)

Code: Select all

<span id='deadlinedategroup1' style='color:#ED1C24;font-weight:bold;'>Overdue</span>
<span id='deadlinedategroup2' style='color:#c79121;font-weight:bold;'>Due Today</span>
group.PNG
group.PNG (13.49 KiB) Viewed 3838 times
Henrik (V8 Developer Ed. - Windows)
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Grouping and labels

Post by PointsWell »

Post Reply