cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 - Clearing valueState of input fields in ui.table

former_member636171
Participant

Hi all,

I'm having troubles resetting the valueState of input fields contained in a table cell. I'm clearing the model so the data is reset but the valueState is set on the view so it persists.

I've tried getting the input field byId and setting the value state as "None" but that doesn't affect the cells of the table.

Does anyone have an idea of how this can be achieved?

I already asked this question here on stackoverflow and there I got asked if I'm setting the value state over a model. I'm not doing that but that sounds like a good idea but I haven't found any examples or documentation.


Thanks,
Birgir

Accepted Solutions (0)

Answers (1)

Answers (1)

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

As explained in this answer, you're probably accessing the template control instead of the real rendered ones. Only the copied controls from the template are rendered with their own IDs. Since their IDs are generated by the framework, accessing such copies with "byId" should be avoided.

Input validation and message creation is a whole different topic.* Here is one small example using a V2 OData model and letting UI5 handle message creation client-side. As you can see, if the input value exceeds the constraints, the value state of the input field is changed automatically.

___

* Doc: Error, Warning, and Info Messages