the method setChildSortDataprovider([dataprovider]) of the DBTreeViewBean (in Servoy 4.1) seems not to work. After changing the value of the dataprovider and a refresh of the DBTreeViewBean or changing the record and going back to the first chosen record does not change anything.
Here is the code:
Christoph:
Is this a bug in the DBTreeViewBean or in my code?
sorry to tell you… it’s your code
I made the same mistake when I first used the DBTreeViewBean.
What you actually should use is a dataprovider that returns a string like ‘bausteine_position asc’;
It works fine for me, Marc is correct, keep in mind that to order the root level of your tree you simply need to sort the foundset used to build it and to sort the childs you need to create a calculation that returns the sorting string as Marc pointed out.
Hi Nicola, thnkx for your completion… forgot to mention the root levelsort.
@Christoph: we have working examples in both versions but as the name ‘setChildSortDataprovider’ explains, this will take care of the sortorder of the child, grandchild, etc. records.
thanks for your posts.
I now found the bug. If the relation I use in setNRelationName() contains more than 1 condition (from table, operator, to table) the DBTreeViewBean wil not sort their child records any more.
was this issue ever fixed? Or could someone tell me what I may be tdoing wrong here?
I have tried the suggestions in the forum and am unable to get the list to sort properly
var binding = elements.beanTree.createBinding(‘database’, ‘parentType_table’)
binding.setNRelationName(‘parentTypeTable_to_childTable’)
binding.setTextDataprovider(‘name’) // company is a field in the clients table
binding.setChildSortDataprovider(‘name_sortAsc’);
binding= elements.beanTree.createBinding(‘database’, ‘childTable’)
binding.setNRelationName(‘childContained_to_childContaining’) //recursive table related to itself
binding.setTextDataprovider(‘contained_name_sortAsc’)
added foundset initial sort to sort the parent nodes
added calcs into “parent” and “child” tables
tried setting the sort to the parent table calc and the child table calc, but the sorting doesn’t work. The only place I can get sorting to work is on the foundset initial sort.