Introduction
In this article I will explain how you can perform paging and sorting in jTable using MVC. But before preceding further in this article please read my previous article since this article is completely based on my previous article.
In my previous article I have explained you how to perform CRUD operation in jTable using MVC and the output of my previous article is as in the following:


In this article I am going to explain to you how to perform paging and sorting.
Paging in jTable: To perform paging in jTable using MVC you have to follow the below given steps:
Step 1: Open Script.js file which we have created in our previous article and write the following lines and update your code.
Step 2: After writing these two lines of code in your Script.js file, lets run the project and output will be as in the following:

Now you can see above we have one table footer there, where we can see complete pagination option. But all the options are not looking and working perfectly. To make it perfect you have to change into action code of listAction. In this example we have listAction Action with name "GetStudentMarks", which is located inside MarksController. So we have to modify inside this.
Step 3: Modify GetStudentMarks action method. To modify it follow the below steps:
- Open MarksController.
- Go to GetStudentsMarks Action.
- Add two parameter jtStartIndex and jtPageSize.
- and write the code for pagination.
I am explaining the above steps using the following figure. In the figure you can see what changes I have done in my GetStudentMarks action method.

Step 4: Run this project


In the above output you can see still we have bug that number of records are undefined and page options are blank.
Step 5:
We are getting this problem because to the client we are not showing how many records exactlyare present in the database so we have to tell this jTable Grid that we have as many records that can be possible by setting TotalRecordCount property's value from controller. So go to the GetStudentMarks action and write following code:
We are getting this problem because to the client we are not showing how many records exactlyare present in the database so we have to tell this jTable Grid that we have as many records that can be possible by setting TotalRecordCount property's value from controller. So go to the GetStudentMarks action and write following code:










Qais SaeedPosted Jan 29, 2018, 9:34 AM
Very helpful. Thank you.
Humayun Kabir MamunPosted Apr 10, 2016, 11:54 PM
Nice...
Sthitaprajnya Debasis NayakPosted Apr 10, 2016, 8:24 AM
Very Nice !!!
Shakti Singh DulawatPosted Apr 10, 2016, 3:21 AM
Nice Job Keep it up
NitinPosted Apr 10, 2016, 1:20 AM
nice
Rahul Kumar SaxenaPosted Apr 9, 2016, 12:26 PM
Good One
Vignesh ManiPosted Apr 9, 2016, 11:16 AM
Nice one
Gowtham KPosted Apr 9, 2016, 10:25 AM
Good one
Kuppurasu NagarajPosted Apr 9, 2016, 10:11 AM
Nice