Use Knockout JS, ASP.NET Web API and ADO.NET Entity Framework to enable pagination in a HTML Table
The question that arises is in what kind of scenarios can we use Knockout JS? Lets’ consider that an HTML page is to be created which makes a call to an external service (WCF Service/Web Service or ASP.NET WEB API) for fetching data and once the data is loaded in the HTML element (e.g. table), pagination is to be implemented. Now this can be done using any JavaScript library like jQuery. However there are some challenges to be thought of like how does the UI update when the underlying data model changes, how to store data on the client side which responds to the change notification for pagination (move previous, next etc.) and calls some logic. Another challenge could be how each user may display different number of rows initially when the page is loaded e.g. (4 rows/ 8 rows etc) and so on. Although these challenges can be coded with libraries like jQuery, it becomes easier if we choose a library that provides binding between UI and data model and has in-built change notification capability.
Your new post is loading...