Community
Participate
Working Groups
When typing text ("a") in a SmartField that has getConfiguredBrowseHierarchy() == true the result set only contains rows matching to "a*". I did not find a possibility to influence the matching criteria. I would like to find substrings, so that rows matching "*a*" are displayed in the drop-down. How can I do that?
I checked you request and in fact this possibility is not (yet) in place. There are normally two ways to solve that in scout, either adding a property or exec method or letting specific models being subclassed. 1) there could be a new exec method on AbstractSmartField boolean execAcceptTreeNodeInBrowseFilter(Pattern pattern, ITreeNode node, int level) that lets you override the decision to accept nodes in the tree when filtering with text. Pros: Easy, simply an override Cons: another property on smartfield that is not very "common", limited decision space. 2) Since the smartfield lets you override createProposalForm() you could create an subclass of SmartTreeForm that adds that behaviour. You could create your own custom smartfield template as follows public abstract class AbstractAbcSmartField extends AbstractSmartField{ @Override protected ISmartFieldProposalForm createProposalForm() throws ProcessingException { if (isBrowseHierarchy()) { ISmartFieldProposalForm form = new SmartAbcTreeForm(this); form.setAutoAddRemoveOnDesktop(false); return form; } return super....; } } public class SmartAbcTreeForm extends SmartTreeForm{ @Override execFilterTreeNode(...) @Override getSingleMatch } Pros: Solution is at the right place, extensible Cons: More todo for your to create that template field. I would prefer solution 2) since it could be easily done and would have no further side effects and has code at the right place with sufficient customization potential.
I prefer solution 2 as well, because it only has to do with hierarchical smart fields (=> SmartTreeForm) Thank you.
Ok, so i implemented the solution. Added (exposed) the following methods: SmartTableForm.execGetSingleMatch() SmartTreeForm.execCreatePatternForTreeFilter(String filterText) SmartTreeForm.execAcceptNodeByTreeFilter(Pattern filterPattern, ITreeNode node, int level) SmartTreeForm.execGetSingleMatch()
It works (tested on 2011-Jun).
shipped with eclipse scout 3.7.2 (indigo sr2)