0

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?

Image of cell with value state "Error"

5
  • do you set your value state also over a model? Jun 16, 2021 at 9:47
  • @bkr No, is that a possibility? It would be great if you could link to an example. Jun 18, 2021 at 9:22
  • How do you set the valueState? Just set it to "None" the same way. Worst case over the table rows and cells after you clear the model...
    – Erch
    Jun 30, 2021 at 12:49
  • @Erch I tried to do that but I couldn't make it work. Do you have an example where you loop through a table and maintain the cell view? Jul 1, 2021 at 13:05
  • @BirgirSnorrason Did answers.sap.com/answers/13424774/view.html help? Jul 5, 2021 at 8:48

1 Answer 1

0

If you really don't want to work with data model, you can just loop over the table and set the ValueState to None.

Code Example:

var aRows, aCells;
aRows = this.byId("table.id").getRows();
for ( var i = 0; aRows.length; i++) {
    aCells = aRows[i].getCells();
    for ( var j = 0; aCells.length; j++) {
        if ( aCells[j] is an input element ) {
            aCells[j].setValueState(sap.ui.core.ValueState.None);
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.