How can i create searchfield box with codenameone - codenameone

I need a search field component but i don't find such a component or a imeoption for text field to make it as search field. i search a lot but still nothing founded.
is there any way to do that?
Thanks in advance.

What do you mean by "search field"?
There is a DataChangeListener that allows you to track fine grained changes to the TextField. You can set a hint & hint icon to show that this is a search field. Its unclear what you are missing.
Edit based on comments:
To get the magnifying glass icon instead of Done button on Android you can use the somewhat undocumented flag:
textCmp.putClientProperty("searchField", Boolean.TRUE);
This is a done event, so you can distinguish pressing this from pressing outside of the field by using the done listener callback on the text component.

Related

How do I change color of clear button in TextField?

We're using the component for a search field. When entering something into the field an "x" clear button appears. I can't figure out how to change the color of this button. We're not using an icon button or anything like that, and if I try to inspect the clear button it I can't find it in the dom, only the input field is shown selected.
I've understood that the normal approach to adding a clear button is to use inputAdornment. We are using inputAdornment for a progress indicator, but I can't find anything in our code for the clear button, so wondering if this is something default and how to go about changing it, or at least get a reference to it so I can use css to style it. Any help appreciated!

Is there a simple way to fake prepopulated suggestions onclick, but onchange show autocomplete resuts using material-ui autocomplete?

Id like to show a popper with data in it which represents a history of searched suggestions on click, but replace that with the default autocomplete dropdown on type, and keep it unless the input is blank. One idea I thought would work was using a onChange handler to detect the length of input typed... which Ive not managed.
On click of the highlighted value Id like to redirect to another page. Currently I'm using json object to hold a few strings, with urls like this.
To achieve the desired results, we will be maintaining two seperate options searchHistory options & the default options. We can toggle between the options by checking if the input field is empty or user has entered something to search through the default options.
I've modified your code on sandbox. Following is the link.
https://codesandbox.io/s/zen-northcutt-fnc03?file=/src/App.js

clearing a material-UI autocomplete field on the press of a button

I am using material-UI autocomplete for a project that involves rendering a dynamic array based on what you select from the menu. I am finished with the project and now trying to implement multi-select to make choosing things from the menu easier. When you have everything you want from the menu, you click an "Add" button that takes everything you currently have selected and adds it to a table (and adds the properly formatted text into a query on the side, the goal is to build queries for users without them worrying about syntax). When I was not using multiselect, and only adding one thing at a time to the query, I was easily able to clear the autocomplete field by changing the value prop to null. This prevents users from adding the same fields to the query over and over (when add is clicked the options that were added are popped from the list of options). When using multi the rules seem to change and now changing value directly causes an error. My question is, does anyone know of a way to programattically click the x button built in to material-ui autocomplete fields to clear that text field in an event handler? Or is there any reliable way of clearing that on my end?

React, react-select placeholder

I did some research but couldn't find usefull solution.
Is that possible to keep placeholder always visible? I mean when I pick any option it replaces placeholder spot, but I do not want this, the desired expectation is to keep placeholder visible all the time.
If you don't want users to see what they selected, but still track it in your app, you can make use of onChange event to capture what users selected, but still pass value={null} to react-select so it think that nothing is selected - and it will display the placeholder.

How to force the search field to be uppercase in ADF: ListOfValues (LOV) component?

How can I manipulate a search field LOV component to force it to be uppercase? I can do this for a LOV field, but I don't know how I can access the LOV pop-up search field that you get when clicking the search icon.
Please see below for field I need to make uppercase:
To be honest, I don't think you can modify the behavior or look-n-feel of the built-in search and lov components. The only possibility I see is if ADF Skinning lets you run the CSS command "text-transform: uppercase;" on the search field.
Otherwise, I would just create a custom dialog box, then build your LOV the way you want it to behave. I did that for most of my lovs in my apps. All the lov is, is a table with filtering enabled.
Good luck!

Resources