Our state of the art Gantt chart


Post by jhughesoneplan »

Hi there,

We've come across an issue with Tree Grouping and wonder if there's any way we can achieve something to fit our use case.

Currently we allow grouping on many fields. For some of these fields - the values may be Guids.

We have been able to handle this with the parentRenderer function and translate them from Guids to their actual text values.

The issue we're having is in regards to the sorting of the grouping rows themselves - not the data under the groups.

It is sorting them properly according to the value, but it is a Guid value which is useless to sort on.

Example:

Parent 1 (has a text value for the first group field)
 	- Child 2 (has a Guid value of 4d86bbf3-14d3-42f9-bbf5-af9581d4d477)
	- Child 1 (has a Guid value of 62fd3bf6-0eaf-4449-967c-269ad7c05e38)
	- Child 3 (has a Guid value of 85078627-e767-4472-bad1-d50cd8c59fbf)

The sorting is technically working properly, but we want to be able to intercept this and sort based off of their corresponding text values so that it should look like this:

Parent 1 (has a text value for the first group field)
	- Child 1 (has a Guid value of 62fd3bf6-0eaf-4449-967c-269ad7c05e38)
   	- Child 2 (has a Guid value of 4d86bbf3-14d3-42f9-bbf5-af9581d4d477)
   	- Child 3 (has a Guid value of 85078627-e767-4472-bad1-d50cd8c59fbf)

Is there any way to implement a custom sorter function to control the sorting of these grouping rows similar to how we can manipulate them with the parentRenderer?

We are not able to do data translation on the records themselves, so that is not an option.

Thanks


Post by marcio »

Hey,

Thanks for reaching out.

You can add a sorter directly to the task store, and sort by a specific field, for example, if you want to sort by name, you can use:

gantt.project.taskStore.addSorter('name')

You can test that on our documentation demo here https://bryntum.com/products/gantt/docs/api/Gantt/feature/TreeGroup

Attachments
Screenshot 2024-06-10 at 18.49.57.png
Screenshot 2024-06-10 at 18.49.57.png (39.8 KiB) Viewed 266 times

Best regards,
Márcio


Post by jhughesoneplan »

Hi Marcio,

This is not really what we're looking for.

We need the ability to use a custom sorter function on the parent grouping nodes, not on the the tasks themselves.

Is there any such way to handle this? The tasks are not the issue, only the group rows with the expand/collapse we need to handle differently.

Thanks


Post by marcio »

Hey,

Oh, sorry. My mistake.

For group ordering, we have https://bryntum.com/products/gantt/docs/api/Grid/feature/Group#config-groupSortFn that you can use to sort the groups.

Best regards,
Márcio


Post by jhughesoneplan »

Hi Marcio,

Does this also apply to the Tree Grouping feature?

Thanks


Post by alex.l »

Hi there,

No it doesn't. As I see from the topic, you don't need that feature, you can go with Group feature and custom sorter, isn't it?

All the best,
Alex


Post by jhughesoneplan »

Hi Alex,

No. We are using the Tree Grouping feature as mentioned in the initial post:

We've come across an issue with Tree Grouping

We need the ability to sort the tree groups.

Thanks


Post by alex.l »

Sure, sorry missed that part, my bad.

As mentioned, TreeGroup doesn't have that option. I've opened a feature request for that here https://github.com/bryntum/support/issues/9366

All the best,
Alex


Post by jhughesoneplan »

Thanks Alex.

I look forward to seeing this in the near future.

Regards


Post by mats »

Can you please share your Grid (columns + features) configs + some dummy data so we can test internally?


Post Reply