cancel
Showing results for 
Search instead for 
Did you mean: 

Server Model How to Filter and Sort within Client

former_member466137
Participant
0 Kudos

Experts,

Created Server model for table display. Initial load looks good and it has got 1000+ rows.

Now requirement is to Filter and Sort loaded data. Since Filtering and Sorting need to be done within table any possibilities to avoid Odata call to back end? So basically within Client since getModel() got data i think if Filtering and sorting will improve performance of App....

Since it's BW query running in background oData call anywhere takes 20 seconds and more.

Any thoughts?

I did like this...But not working...

oTable.getBinding("items").sOperationMode = "Client";

Accepted Solutions (0)

Answers (6)

Answers (6)

catano
Participant

Hi,

Take a look at this example:

Samples - Grid Table - Sorting

The sample uses JSONModel for table items, no request to server will be made.

Retrieved data from ODataModel can be set to JSONModel with setData() method.

Regards,

Peter

former_member466137
Participant
0 Kudos

Ok...Let me try that..Will get back

former_member644035
Discoverer

Try setting useclientmode to true.

oTable.getBinding("items").useClientMode = true;

former_member466137
Participant
0 Kudos

When this oTable.getBinding("items").sOperationMode = "Client" statement gets executed

useClientMode() sets to True.

former_member466137
Participant
0 Kudos

I am using Responsive Table since requirement involves Mobile Interface as well. I will check on Sorting in Grid Table...

Also i have a new issue...can you please help here

https://answers.sap.com/questions/13002442/jsonmodel-how-to-identify-changes-done-to-table.html

former_member466137
Participant
0 Kudos

Yes....init also...

But my requirement was different...Based on action table should reload...Anyways in init as well as i do have JSON binding from OData.

catano
Participant
0 Kudos

Try download the sample from Samples - Grid Table - Sorting, and modify the data part. I'm sure it works, maybe there is some typo in your code what we cannot see without the complete code.

former_member466137
Participant
0 Kudos

Declare oModel as Odata Model...Read from Backend using Read Function.

In Success function, bind oData received to JSON Model. setData{ zmrktseg: oData-results }

Then bind JSONModel to View.

this.getView().setModel(oJSONModel)...Here you go..

catano
Participant
0 Kudos

You do your setModel() binding in Controller.onInit(), right?

former_member466137
Participant
0 Kudos

Just build JSON way but data not getting into View. Can you help what am i doing wrong?

catano
Participant
0 Kudos

Can you share please, how do you define and how do you bind the JSONModel to the view?