Our state of the art Gantt chart


Post by peter4ef »

Hello,

In the 5.5.3 version of the Gantt and Scheduler Pro components, we used a ResourceStore that is grouped by a departmentDescription field, however all records also have a sortOrder field, which we used to sort by. We did this using the groupSortFn config:

     group: {
       field: "departmentdescription",
       groupSortFn: departmentSortResources,
     },

And in this function we had access to all of the fields of the resource record, which we could use to sort them:

Screenshot 2025-03-13 132210.png
Screenshot 2025-03-13 132210.png (46.22 KiB) Viewed 459 times

In version 6.1.6 with the same groupSortFn, we no longer have access to any other fields than the departmentDescription in the sort function:

Screenshot 2025-03-13 131415.png
Screenshot 2025-03-13 131415.png (28.13 KiB) Viewed 459 times

How can we make this information available again? Or is there a different way to sort the groups and records within them on certain fields?


Post by alex.l »

Hi,

As far as I see, the config is still there https://bryntum.com/products/gantt/docs/api/Grid/feature/Group#config-groupSortFn
How to reproduce the scenario you mentioned?

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post by peter4ef »

The config is still available and the groupSortFn still works. But previously it was possible to sort on other values than just the field that is grouped by. So we have resource records that have both a departmentdescription field, and a sortorder field. We group by the departmentdescription, but sort the groups by sortorder. And in version 5.5.3, this worked. But in version 6.1.6 the extra fields are no longer available in the models passed to the groupsort function.

The way to reproduce it would be to have resources with at least 2 different fields, try to group by 1 of the fields, and sort by a different field.

I couldn't find a demo project with a grouped histogram to reproduce this in.


Post by alex.l »

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post by peter4ef »

The resourcestore and records absolutely have those extra fields. But it seems like the groupSort function is given some sort of group header object which does not have all of the fields that the resources have.

The picture below may help illustrate the issue. I made the extra fields visible in the grid. The records have the extra fields, however the group headers do not. And in the sort function I only have the group header records after the update. In the olf version the other fields were also available.

Screenshot 2025-03-14 085455.png
Screenshot 2025-03-14 085455.png (47.71 KiB) Viewed 424 times

Post by peter4ef »

I found a way around this issue. The group children are available, so I look up the requires properties of the department record using the groupChildren property:

export const departmentSortResources = (a, b) => {
  const depA = a.groupChildren.find((i) => i.resourceType == 2);
  const depB = b.groupChildren.find((i) => i.resourceType == 2);

And I think this is also how it is supposed to work, since I was sorting on properties we specifically added to the children in order to influence the sorting of the groups. It was just a bit hard to find the right properties.


Post by alex.l »

I see now, thanks for your patience! I've opened a ticket to fix this https://github.com/bryntum/support/issues/10939
You can subscribe on ticket updates to be notified when it's done.

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post by peter4ef »

Thanks for your response. But our current code is a workable solution for what we need. It behaves the way we want, and I am not seeing any performance issues.


Post by alex.l »

Yep, we just need to fix docs to make it more clear and consistent.

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post Reply