Our blazing fast Grid component built with pure JavaScript


Post by veverto »

Hello guys,

My question is about the Tree Grid: is there any way to customize the way the tree identifies that that node has children? As stated in: https://www.bryntum.com/docs/grid/api/Core/data/AjaxStore#config-parentIdParamName), each object must have

children:true

, is there any way to modify this

children: true

Thank you.


Post by marcio »

Hey veverto,

No, the

children: true

is mandatory for tree structure, that parentIdParamName is to replace in the child records that by default uses parentId to the key specified in that parentIdParamName config

Best regards,
Márcio


Post by veverto »

Are there any plans to change this in the future? It would be perfect if I could.


Post by marcio »

I don't think so, but could you elaborate a test scenario description for this?? With that, we could analyze with more clarity your case and decide if it's something that we would develop in a future release.

Best regards,
Márcio


Post by veverto »

Yes! I can.

My suggestion is very similar to something that already exists, which would be in this case these features https://www.bryntum.com/docs/grid/api/Core/data/AjaxStore#config-responseDataProperty, https://www.bryntum.com/docs/grid/api/Core/data/AjaxStore#config-responseSuccessProperty and https://www.bryntum.com/docs/grid/api/Core/data/AjaxStore#config-responseTotalProperty.

In these cases we can customize the name of the property we want to use. My idea is to follow the same line to

children:true

Where the string 'children' could be used by default, with the possibility of changing it to something I want, for example:

new TreeGrid({
    ...,
    hasChildrenProperty: 'hasChildren'
})

In this case the tree would know that a given node has a child when 'hasChildren' has 'true' as its value.


Post by marcio »

Thanks for that description! I created a feature request ticket for that, you can follow the discussion here https://github.com/bryntum/support/issues/5177

Best regards,
Márcio


Post by veverto »

Thanks for the help in solving the problem!


Post by marcio »

Best regards,
Márcio


Post by veverto »

But this field does not fulfill what I wanted to do, which is to modify which field identifies that a certain node has children and not which property of the children themselves. You even explained it perfectly well there in the ticket.


Post by marcio »

Hey veverto,

If you see the type of https://bryntum.com/docs/grid/api/Core/data/mixin/TreeNode#field-children you'll notice that it has a boolean as well, so you could set it up as it's mentioned in the ticket with the childrenField property.

Best regards,
Márcio


Post Reply