KendoUI filters and paging functionality - How they work with large JSON data - kendo-ui

I have 100,000 records right now (will grow in future). I have JSON api call (remote URL, however, within same server) to get those records. If I use KendoUI with paging turned on (say 50 per page), will KendoUI datasource going to fetch all those records and bring them into client and apply paging? Or is it something I need to pass to the server (page size) to be able to only get only needed data for display? If I need to pass, do I have to write custom data source query methods?
Same question goes for using filter input boxes in toolbar within KendoUI.

There are two (efficient) ways of loading that amount of data:
Setting serverPaging to true in the DataSourcedefinition.
Using serverPaging plyst (as #bobosov534 and #gitsitgo suggests) virtual scrolling.
In the both you receive in the server tow parameters: top indicating the number of records to retrieve (what you have defined as pageSize) and skip for the number of records to ignore (no skip means the first top records).
The difference is that int the first you see a pagination bar in the bottom of the grid and in the second you see additional records as you scroll down.
In DataSource.serverPaging you find detailed information on the fields sent to the server for managing pagination.

Related

Should i send filter with AJAX or filter an array?

i'm implementing a web page that shows certain rows fetched from a database.
At loading, i make an AJAX request to fetch the rows in a certain range of time(the initial call will take today's rows), and save them in a global variable(e.g "rows").
I have two text field to set the starting and the ending point of my research, and every time i change the value of those text-fields, i make another call to the db to get the new data and update global "rows" variable.
My question is: if i have different text-field filters and sort options that apply filters and sort to the fetched rows, should i make another request to the db(with the selected filters/sort) and let the db handles the filter/sort, or should i apply the filters/sort directly the global "rows" variable?
Of course i think the db filtering and sorting would be more efficient, but the number of rows shouldn't be more than 100, max 200 rows, and i was wondering if it would be worth it to make another AJAX request just for filter the result.
Thank you very much in advance.
have you try with datatables server side??
https://datatables.net/examples/data_sources/server_side.html
I think is a good options for you and very easy to implement

TableSorter too many records

I have already implemented TableSorter in my project. Now the problem is that in some case I need many records more than thousand. And TableSorter plugin does pagination client side through ajax. I want it to do server-side pagination + I want to sort on a single page, not on whole data. i.e. If there are 10 records on a single page of TableSorter, sorting must be done on that single Page(on that 10 records only). I can't change to another table plugin. What should I do? My data is coming from model.
For the pager ajax demo, I had to change the serverSideSorting option manually to make it sort the current table contents. Maybe that will also work for you? Try including this code:
$('table').bind('pagerInitialized', function(e, c){
// allow current content sorting; this variable is automatically
// set to true when ajax is initialized
this.config.serverSideSorting = false;
});

Pagination in Classic ASP with VB Script

I am using ASP/VB Script in my project but, i don't have much idea of Pagination in Classic ASP. I have designed a datagrid format using tables and looping. That table is filled by accessing database. As we have a huge amount of data to display, we need pagination.
Thanks in advance
The pagination problem is not inherently to ASP classic or VBScript. You need first to define which strategy to follow:
In the client:
Ajax style pagination (You can use a jQuery plugin like SlickGrid)
Linked pagination: Your page have links to page 1, page 2, etc.
Infite scrolling: This is a modern way to do pagination, with more results added to the page via ajax
In the server
Full DB results retrieve and return only the page asked. This is sometimes necessary.
Full DB retrieve but caching the result so subsequent page request come from the cache, not the DB
Ask the DB only the page asked (Different techniques depending on the DB engine)
There is a issue you need to be aware of... the built-in ASP record set will allow pagiing, however is not very efficient. The entire result set gets returned to the browser and then it locates the appropriate page and displays that data.
Think of it like this... your result set is a 4 shelf book case. When you ask for page one all 4 shelves of books get returned. The the display code says "Okay now only show page 1". If you then ask for page two... All four shelves of books gets returned and then the display code says "Okay give me page 4".
So, you should look for a paging solution that takes place on the server, inside the database. This way if you ask for page 15 of a 50 page result, the database will only return one shelf of books.
This google query should put you on the right track.
Edit: How SQL Paging Works
You must us a stored procedure
One of the input parameters is the page to view
The stored procedure filters the results on the server
Here is the basic concept of what happens inside the proc:
Step 1:
Create a temp table that stores the entire result set. My preference is to store only two values in this temp table. An identity seed value called RowId and the primary key of the result data. (I'm one of those people that believes in non-sensical identity seed keys)
Step 2:
Insert all the PKey values from the select statement into the temp table
Step 3:
Determine the StartRowId and EndRowId based on the input page parameter.
Step 4:
Select from the temp table using an inner join to the datatable on the PKey. In the where clause limit the result so the RowId (of the temp table) is between StartRowId and EndRowId. Make sure to Order By the RowId.
Set page size
recordset.PageSize = 100 ' number of records per page
Set the current page
recordset.AbsolutePage = nPage ' nPage being the page you want to jump to.
Other useful bits:
recordset.RecordCount ' number of records returned
recordset.PageCount ' number of pages based on PageSize and RecordCount
That's the basic info. You'll still need to loop through the appropriate number of records, and check the page number as it is passed back to the page.

Telerik Rad Grid Sorting

I have a rad grid which fetches the data from database and displays required number of records even though there are number of records
eg: if there are 10,000 records which comes under search criteria. But we are retriving only the records equals to page size. ie., if paze size is 10 then 10 records will be retrived even though there are 10,000.
This is done to overcome performance issues while loading millions of records.
Now the problem is if user clicks on grid column to sort only 10 records are getting sorted. But i need all the records in a sorted order then required records get displayed in the page.
Two possibilities pop up in my mind:
If you use LINQ or Entity Framework, the telerik grid will perform the paging on the database server and only the items on the current page will be loaded. See demo here.
Use manual custom paging or binding to ObjectDataSource as in this sample.

Filter Toolbar without loadonce:true?

I am using jqgrid, with filter toolbar(column) option...The total data is around 10,000...So it seems to be some delay in initial loading as the config is set to loadonce:true;
Any way to implement the filter column feature with loadonce:false ?
Because the data loading delay is okay with loadonce:false. If I get a chance to add column filter with loadonce:false, this will work perfectly...
If you has about 10,000 rows it is of course better to implement server side data paging, sorting and filtering. I recommend you to use filterToolbar with the parameter stringResult:true if you not already use it. In the case jqGrid will send to the server filters parameter in the same format like advanced searching as do. So you will need implement on the server side the method which use following input parameter from jqGrid:
sidx and sord parameters define the sort order of the data. The informations specify ORDER BY in the corresponding SELECT statement.
if _search parameter is true, then the next parameter filters gives additional information which construct the WHERE part of the corresponding SELECT statement.
page and rows parameters define which page of the data previously sorted and filtered should be returned.
The exact implementation is depend on the language and technology which you use on the server and of course which database server and which interface to the database you use.

Resources