cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting in Editable smart table

appu24
Explorer
0 Kudos

Hello Experts ,

We have a editable smart table with a button to mass maintain values for a column based on some calculation . the user is trying to sort the column before saving , however the sorting is not considering the values entered by the users. 

the data is refreshed and sorted as per the values in the database . 

what is missing so that it considers the entered values to sort the column in table ?

I was able to produce the same issue in SAPUI5 sample. changed the binding Mode to twoway. modified all the negative values in column "Amount in LC"  sorted the column by Ascending. it still sort considering orginal values  @SAPSupport 

appu24_0-1715934447311.png

 

 

Thanks , 

View Entire Topic
RaminS
Participant
0 Kudos

One of the principles of Fiori framework in conjunction with SADL and Hana DB is "code pushdown". When you bind a smart-table with a CDS view or a table, the sorting, pagination, filtering all happens at the database layer, not the UI. Every time the user adds a filter, or changes the sorting, or pages down through the data, the engine needs to re-execute the CDS view, and bring back the top 20 records (or whatever # the request specifies).

So if the newly entered data is not stored in the database, the re-execution of the query will not include them.

Have you implemented Draft handling? In a draft enabled scenario as soon as the user leaves an enterable field the value of the field is saved in the draft record. So if you re-sort the result will include the new content.

If you don't have draft-handling, then perhaps you can trap the sorting event in the controller and if in edit mode don't let it sort, ie. don't to a binding update.

 

appu24
Explorer
0 Kudos

Hello RaminS ,

Thanks for your response . You are right however , in our scenario the application is just used to simulate the scenerios on data and nothing is really saved back to DB. we neither have implemented draft . So based on answer i guess instead of using   below sinppet to sort 

var oCustomTable = this.getView().byId("customTable");
var oBinding = oCustomTable.getBinding("items");
var oSorter = new sap.ui.model.Sorter(<fieldName>, true/flase);
oBinding.sort(oSorter);

i will have to implement some custom sorting on client side . ? any reference would be helpful u  have one.

Thanks ,

Appu