can’t get this excellent bean to sort child nodes. As this is supposed to work in 3.5.6, has anybody got pbs woith this?
the example supplied by servoy has a sort field, but it’s not used in the dbtreeview setup method. any known problem?
another weird thing: when you define the method to execute upon node selection with setMethodToCallOnClick, this method gets executed, which should not; it is only a setting for clicks! same thing happens when it gets refreshed automatically upon creation of a new record which generates a new child node. is that really normal?
Regarding sorting: you can provide a dataprovider name in the binding that if present is the sort column.
Regarding setMethodToCallOnClick: yes, I think that is normal. The method should probably be called setMethodToCallOnSelection, because I think that’s what it really is.
lesouef:
another weird thing: when you define the method to execute upon node selection with setMethodToCallOnClick, this method gets executed, which should not; it is only a setting for clicks!
Make sure that you don’t include brackets when specifying the method, so use:binding.setMethodToCallOnClick(method, 'returnDataprovider');
instead of ```
binding.setMethodToCallOnClick(method(), ‘returnDataprovider’);
Joas,
about method syntax, I have the correct syntax, no parenthesis after method name.
Patrick,
about the sort field, I have one, but it makes no difference.
If you try it on the servoy example by adding the right line (the field exists, but the bean is not set to use it), it does the same.
Can you post the method that initializes your tree?
here it is:
elements.bean_nav.removeAllRoots();
$binding = elements.bean_nav.createBinding(controller.getServerName(), ‘products’);
$binding.setImageURLDataprovider(“bean_image”);
$binding.setChildSortDataprovider(“bean_sort”);
$binding.setHasCheckBoxDataprovider(“bean_checkbox”);
$binding.setCheckBoxValueDataprovider(“”);
$binding.setNRelationName(“products_to_components”);
$binding.setTextDataprovider(“bean_txt”);
$binding = elements.bean_nav.createBinding(controller.getServerName(), ‘components’);
$binding.setImageURLDataprovider(“bean_image”);
$binding.setChildSortDataprovider(“bean_sort”);
$binding.setHasCheckBoxDataprovider(“bean_checkbox”);
$binding.setCheckBoxValueDataprovider(“”);
//$binding.setNRelationName(“components_to_formsinfo”);
$binding.setTextDataprovider(“bean_txt”);
$binding.setMethodToCallOnClick(show_record, ‘cp_jobid’);
elements.bean_nav.addRoots(forms.products_filter.foundset);
elements.bean_nav.visible = true ;
and another one:
when using setExpandNode on a five node object, it does not open the 5th one while it has children.
lesouef:
another weird thing: when you define the method to execute upon node selection with setMethodToCallOnClick, this method gets executed, which should not; it is only a setting for clicks!
I cannot reproduce this. If you can, please create a case in the support system with a small sample solution.
thanks for yr help, but I am on a hurry, and this is a bit special. I am a sub-contracter on this project, I signed a serious NDA, I can’t show anything; to show you, I must create an example. So I do that if I can’t overcome the problem. Obviously I’d better get rid if this bean before I hate the solution, I just discovered it is sticky, which means: when you create a new record, what ever you do after record creation it brings you back to the active node.child so you can’t enter any information in the new record. So i’ll try to find a way to neutralize it during record creation, like removing all roots, create a record then reset the roots again, this may work though the active node/child after record creation will remain random… If there is an example somewhere which shows all functions running OK, I am interetested.
I finally worked around the problem as explained in the previous post, that is removing roots before creating the new record, re-creating the roots right after it, then use selectionPath to force the bean to point to the newly created record/child. not very smart, but works…