on 02-11-2015 6:34 AM
HI All,
I have an Table designed in XML view using mobile library and displays the records from northwind service.
Code:
<Table id="idProductsTable" | |
inset="false" | |
items="{/Products}" | |
visibleRowCount= "7" | |
mode="MultiSelect" | |
modeAnimationOn="true"> | |
<headerToolbar> | |
<Toolbar> | |
<Label text="Products"></Label> | |
</Toolbar> | |
</headerToolbar> |
<columns> | |
<Column | |
width="12em"> | |
<Text text="Product Name" /> | |
</Column> | |
<Column | |
minScreenWidth="Tablet" | |
demandPopin="true"> | |
<Text text="Category ID" /> | |
</Column> | |
<Column | |
minScreenWidth="Tablet" | |
demandPopin="true"> | |
<Text text="Supplier ID" /> | |
</Column> | |
<Column | |
minScreenWidth="Tablet" | |
demandPopin="true"> | |
<Text text="Unit price" /> | |
</Column> | |
<Column | |
minScreenWidth="Tablet" | |
demandPopin="true"> | |
<Text text="Unit in stock" /> | |
</Column> | |
<Column | |
minScreenWidth="Tablet" | |
demandPopin="true"> | |
<Text text="Unit on order" /> | |
</Column> | |
</columns> | |
<items> | |
<ColumnListItem> | |
<cells> | |
<Text text="{ProductName}" /> | |
<Text text="{CategoryID}" /> | |
<Text text="{SupplierID}" /> | |
<Text text="{UnitPrice}" /> | |
<Text text="{UnitsInStock}" /> | |
<Text text="{UnitsOnOrder}"/> | |
</cells> | |
</ColumnListItem> | |
</items> | |
</Table> |
Questions:
/sap/opu/odata/ZTEST_SRV/entityset(orderno="1234") " this is how i send one order no back to SAP now how to send the table of values?
Please help me out.
I have searched before posting i could not find any reference related to table XML views.
Hi Deepan,
implement the below two methods on click of your delete button in your controller.
we have a method getSelectedIndices which returns the selected indices in an array.
We have a method removeRow which takes your index as input and removes the row.Run a loop so that all the rows can be removed (use indexe array which is obtained in the step).
https://sapui5.netweaver.ondemand.com/sdk/docs/api/symbols/sap.ui.table.Table.html#removeRow
Cheers
Pandu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please note the 'removeItem()' method only removes the visible row (i.e., the controls) from the aggregation, it does not remove the actual data from your model
I therefor strongly advise not to use the removeRow() and removeItem() methods since they are useless when using data binding
A much better approach is to retrieve the selected contexts from your table, and then remove the corresponding objects from the model:
handleDelete : function(oEvent) {
var oModel = this.getView().getModel();
var aRows = oModel.getProperty("/rows");
var aTable = oEvent.getSource().getParent().getParent();
var aContexts = aTable.getSelectedContexts();
for (var i=aContexts.length -1; i>=0; i--) {
var oThisObj = aContexts[i].getObject();
var index = $.map(aRows, function(obj, index) {
if(obj === oThisObj) {
return index;
}
})
aRows.splice(index, 1);
}
oModel.setProperty("/rows", aRows);
aTable.removeSelections(true);
},
Please not the above does not take custom sorting and or filtering into account, but you get the idea
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.