Reputation: 199
Im facing a small issue in sap.m.Table
. I want to remove a value in the column. But the value should not get removed from the model..
From the above image.. I want to remove the Unathorized absence from the table. But that value must be available in the model. For that I'm using below code...
this.getView().byId("idProductsTable").getItems()[2].getCells()[3].setProperty("text", "");
From the above code.. value is getting removed from both model and table. But my requirement is like value should be removed only from the Table.
This is what is happening with the above piece of code. Value is getting removed both from model and table.
If I remove the value from the table, it should get removed from the table but not from the model.
Upvotes: 1
Views: 196
Reputation: 18064
Use the property visible
in the Text control, for example, with an expression binding:
<ColumnListItem>
<cells>
<!-- ... -->
<Text
visible="{= ${myModel>LeaveType} !== 'Unauthorized absence'}"
text="{myModel>LeaveType}"
/>
</cells>
</ColumnListItem>
The text will be then "removed" but only from the UI. In the DOM, the text element gets the CSS property display: none
which doesn't occupy any spaces in contrast to visibility: hidden
.
Note: The above code snippet is just a short example to give you an idea. Do not compare text values to hard coded string literals that might be translated or easily changed. Adjust the code according to your project.
Upvotes: 1