bsgriggs / mendix9-searchable-reference-selector

Mendix reference, reference set, and enumeration selector with a search bar and a clear button.
MIT License
2 stars 2 forks source link

Suggestion: Clear the filter. #18

Closed I8NHJ closed 1 year ago

I8NHJ commented 1 year ago

In my case, the selectable objects are fed by a Microflow that selects objects from a database over an association. It would be beneficial to automatically clean the search area when the microflow is called. This way the user has visual feedback that the previous filter is not valid anymore.

bsgriggs commented 1 year ago

I'm not sure I understand your use case. The search text should clear automatically if the user isn't focused on the input anymore.

If the user is still focused on the input, I shouldn't clear the search text because the user is actively searching ~ entering search text re-runs the data source.

I8NHJ commented 1 year ago

Hi there, thanks for the quick answer. I understand my request was a little foggy. Please bear with me while I'm trying to explain what is going on. My original project has two reference selectors. The first one allows the selection of job sites, and the second one selects elements belonging to the selected job site. There is a non-persistable object with association to the jobsite and cells table permitting the use of reference selectors. Selecting a job site from the first reference selector refreshes the non-persistable table which is the data source for the second reference selector. With this widget, it is not possible to use non-persistable tables as the data source, so the workaround was to use a microflow to filter out the data. This turns out in an inconsistency between the data and the view until the focus is set back to the widget triggering the microflow.

Please look at the screenshots showing the behavior with the standard reference selector and the searchable reference selector: snip1 snip2 snip3 snip4

bsgriggs commented 1 year ago

hmm I think I understand now. Have you tried using the OnChange action for the Jobsite dropdown to set the Cell Designation to empty?

I8NHJ commented 1 year ago

That worked, thank you!

Being able to use a non-persistable data source for this widget, along with other sources, will be the perfect solution, though, and will match the original options available for the reference selector.

bsgriggs commented 1 year ago

It is not possible to select non-persistent data sources for Type Database or Type XPath because non-persistent data does not exist in the database at all. Non-persistent data has to come from a Microflow or a Nanoflow