on 2019 Jul 15 3:15 PM
Dear fellow Sappies,
I am new SAPUI5 and I was not able to find a solution to a problem that should not be that difficult.
My database table looks something like this:
TestTable
firstName | secondName | protected
-----------|-------------|----------
John | Doe | X
Chris | Parker |
Now, I want to display this table (the first two columns) in a sap.m.Table.
The table should be in "delete" mode, so that I can delete all columns that are not protected.
In my view, I defined a table like this:
<Table mode="Delete" delete="_onTableDelete" id="testtable" items="{/TestSet}">
<columns>
<Column>
<header>
<Text text="First Name"/>
</header>
<footer/>
</Column>
<Column>
<header>
<Text text="Second Name"/>
</header>
<footer/>
</Column>
</columns>
<items>
<ColumnListItem type="Active">
<cells>
<Text text="{firstName}"/>
<Text text="{secondName}"/>
</cells>
</ColumnListItem>
</items>
</Table>
How can I achieve that the delete button at the end of each row is only shown if the "protected" attribute is false?
Thank you very much for your help!
Request clarification before answering.
Hi,
Though using a custom button as suggested above can work.
Here is how you can remove the delete button.
Use the updateFinished event handle of the table.
Inside that you can loop in the rows of the table, and for the row which has protected 'X' you can set the button visibility false.
Try if this works.
Regards
var rowCount = oTable.getItems().length;
for( rowIterator = 0; rowIterator < rowCount; rowIterator++ ){
var row = oTable.getItems()[rowIterator];
var protected = false;
//**Writre Logic here to get the "proctected" value for the current row
if(protected){
row.getDeleteControl().setVisible(false);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
16 | |
10 | |
7 | |
7 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.