on 2016 Jun 02 9:10 AM
Hi,
Sorting of Numbers in my XML View is not working.
I have searched the forum and got to know that JSON treats all as characters.
Some post were referencing to use sap.ui.model.Sorter and fnCompare
My view is an XML view. How do I use this or is there any other solution?
Here is my XML Code for table column on which I want the sorting.
<Table:Column hAlign="Right" width="10em" sortProperty="Kwmeng" filterProperty="Kwmeng">
<Table:label>
<Label text="Order Quantity" />
</Table:label>
<Table:template>
<Label text="{ path:'SalesModel>Kwmeng',type:'sap.ui.model.type.Float'}" />
</Table:template>
</Table:Column>
Any help would be highly appreciated.
Regards,
Firoz.
Hi Firoz,
You might be having it in string format. Try converting to float using parseFloat() before binding.
Will this sample help? Plunker
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Sai,
As suggested by you I converted the string format using parseFloat() and sorting issue got solved !
Here is my code for conversion:
oModel.read('/openorderSet',null,[fltr],false,function(oData){
for (var i = 0; i < oData.results.length; i++) {
var oOrdQty = parseFloat(oData.results[i].Kwmeng);
oData.results[i].Kwmeng = oOrdQty;
}
oJsonModel.setData(oData);
sap.ui.getCore().setModel(oJsonModel, "SalesModel");
},function(){
alert("Read failed for order item");
});
Many Thanks,
Firoz.
User | Count |
---|---|
68 | |
8 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.