I have an item that I want to change. So I used the oh-input-item, but the actual value is not displayed (below 13 %). So the value always starts with 0. What am I doing wrong here?
Youâre not doing anything wrong here. This looks like a bug. I suspect that the oh-input component hasnât actually been fully updated to work with the new quantity information available in the widgets. If you check your browser console, you will see that the input is throwing a warning about '13 %' not being a number that the number type input can parse.
If you just change type: number to type: text in the input, it should work, but youâll have to be careful about what you enter in at that point.
This is definitely worth filing an issue on the UI repository.
@JustinG Iâm not familiar with oh-input - is the spacing between the end of the input box and the checkmark button usually that far apart? Also the start of the input box seems like it should be aligned with the label above it. It looks terrible! Is there a rhyme or reason for it to look like that by default?
Try setting a state description of %.0f %%. Right now it is using a default state description of %.0f, and as this is dimensionless, it cuts off all after the comma. It doesnât seem to use the % unit definition though. Do you have this item linked to a channel? What is the state description on that?
You should be able to enter with the unit in the entry value.
Make sure to have useDisplayState on in the widget definition.
@jimtng I donât think this is a bug. You proposed fix brakes the logic, not showing the unit anymore.
True. When I created this, thatâs the way I intended it to be used. But for BasicUI and the android app in sitemaps I went for a solution showing the unit separately (but can then not be changed) when using a number field, so you kept the number controls. This was never implemented for oh-input-item. I sticked to the standard html input types.
Two ways: Let user edit the whole thing as text, including the unit, or let them enter the number in one input, and the unit in another input, so the unit is also editable. If we want to go even further⊠give them a drop down of compatible units
Which sitemap widget does this? I tried Input but it lets me edit the whole thing including the unit, and no number controls (up/down). It acts like a standard text input.
Very nice.
Out of interest, what is the logic behind it to decide if an increase/decrease button press changes an integer or a decimal value?
Just asking if there is a requirement to change a value from 0.3 to 0.4
The input components have, if I recall, always had some style issues. I donât know if thereâs any technical or other reason behind it. I donât use them enough to have paid too much attention to it (I think I have one rarely used widget that includes an input).