on 2014 Nov 13 8:58 AM
Hi I would like to implement "infinite scroll" in a web client library called ExtJS.(The backend is SQLA,JAVA,DBUtils,REST,JSON)
This means each DB fetch only returns a fraction of the list from the DB defined by parameters Start and Limit. This divides the list into "pages" (of size Limit) and only "visible" pages are fetched.
ExtJS also wants to know the total size of the list. How do I go about returning a "page" of rows plus a scalar that is the total size of the list, using a stored procedure
Or am I forced to call 2 stored procedures?
Peter
Request clarification before answering.
If you don't mind the total count returned with each row you can use select top x start at y column names, COUNT(*) OVER() AS TotalRows from tablename order by xyz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It would be nice if we could have a similar setup for json as we have for XML:
select
(select count() from address) as NumberOfRecords,
(select Id, Code from address order by Id for xml auto,elements) as Address
for xml auto, elements
If we could replace XML with JSON then you would get what you need. Maybe something for the future?
I tried to achieve something like this with a work around but I couldn't succeed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
29 | |
9 | |
8 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.