on 07-17-2018 12:46 PM
I have a table with some 100 rows. if the value of a data is greater than 7, i have to show such rows at the top of the table. how to do it in sapui5 using js or jquery.
Hi,
pass the sorter in binding
items="{path:'ENTITYSET PATH', sorter: { path: 'PROPERTY NAME', descending: true}}"
Here is the code sample
myview.xml
<Table items="{path:'data>/ProductCollection', sorter: { path: 'Price', descending: true}}">
<columns>
<Column width="12em"><Text text="Product"/></Column>
<Column><Text text="Supplier"/></Column>
<Column id="netPrice" hAlign="End"><Text text="Price"/></Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{data>Name}" />
<Text text="{data>SupplierName}"/>
<ObjectNumber number="{path: 'data>Price'}"/>
</cells>
</ColumnListItem>
</items>
</Table>
mycontroller.js
onInit: function() {
var oJsonModel = new sap.ui.model.json.JSONModel({
"ProductCollection": [{
"ProductId": "HT-1000",
"Name": "Notebook Basic 15",
"SupplierName": "Very Best Screens",
"Price": 5
}, {
"ProductId": "HT-1001",
"SupplierName": "Very Best Screens",
"Name": "Notebook Basic 17",
"Price": 2
}, {
"ProductId": "HT-1002",
"SupplierName": "Very Best Screens",
"Name": "Notebook Basic 18",
"Price": 8
}, {
"ProductId": "HT-1003",
"SupplierName": "Smartcards",
"Name": "Notebook Basic 19",
"Price": 7
}, {
"ProductId": "HT-1007",
"SupplierName": "Technocom",
"Name": "ITelO Vault",
"Price": 7
}]
});
this.getView().setModel(oJsonModel, "data");
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.