How can we limit and page the number of records that are pulled down from the AppServer per request?
We are trying to build a simple transaction viewer grid that displays selected transaction information. The BE is read-only, no create/update/delete. The transaction table has more than 61,000 records and all records are pulled down and read into the grid before the grid displays. It takes more than a minute before the UI is first displayed. Navigation within the records is quick once the grid has been built. We'd rather the grid be displayed quickly with perhaps 10 or 100 records to start with. The user can then enter the appropriate filter with (e.g.) the desired date range and another request should go back to the AppServer to retrieve another data set. Even with no filtering, as the user navigates through the data, the UI should make requests as needed for more from the AS.
We see the references to implementing [myCount and setting serverPaging to true] here:
We tried implementing the myCount method (but not JFP stuff), but no records are returned and the KUIB app displays an "Unexpected response from 'MyCount' operation" error.
1. To implement paging to reduce network traffic as described above, do we need to implement the JFP input and myCount things (including adding a seq and id to probably every table that's accessed by the KUIB) as documented above?
2. Are there any working app code samples that implement such paging?
3. Is there a simpler, more maintainable way to implement paging to reduce network bandwith? It's just not practical in any real app to always bring down thousands of rows every time a data grid is displayed. I just wonder about the long term maintenance that we'll need to implement all these back end and front end customizations to make the apps perform in a usable manner.
Here are short answers to your questions then more detail:
1. Yes, you would need to enable JFP support in your Business Entity.
Please notice that the extra seq and id fields are only needed on the temp-table definition, they are not required in the actual database table.
The seq field is used by the code to support sorting.
The id property is used to support queries using an ID. This functionality is currently not used by Kendo UI Builder.
In practice you can actually implement your own way to handle queries.
It does not need to be JFP.
2. Yes, the code in the documentation is a code sample.
3. As mentioned earlier, you can implement your own way to handle queries.
Please let me know if you are interested in this approach and I can provide more information.
The key to enabling paging is to turn off the "Client-side Processing" in the Data Source definition. (Edit Data Provider / Edit Data Source)
This will enable the server-side processing which sets serverPaging, serverFiltering and serverSorting on the DataSources generated by Kendo UI Builder.
You will then see these properties are automatically generated and set in the generated code in controller.js.
When serverPaging, serverFiltering and serverSorting are set to true, the Kendo UI DataSource sends the request to the remote service. This is done via the JSDO.
You would need code in your Business Entity that can process the request sent by the datasource.
A way to do this is to use the JFP (JSON Filter Pattern).
You can implement your own filter pattern but it is easier to use the JFP. It depends on your requirements.
The PDF that you mentioned has a sample implementation for it.
You can also find this section online at:
You would need to do update the READ method to process the JFP, perhaps by calling JFPFillMethod() as in the sample code or doing your own processing.
The count method is used to return the total number of records for a result set.
The "Unexpected response" message would mean that the response does not have the expected structure. Please confirm that the signature of the count method as in the one in the same.
What do you see in the Network tab in the Developer Tools?
The PageSize property in the grid properties and the Data Source definition controls the value of the pageSize that is generated.
Please let me know if you have comments or questions.
I hope this helps,
Thank you for your explanation and sample code.
This worked well and was pretty straightforward to implement.