server-side query count
server-side query count
First off, dataTables is amazing, I could replace hundreds of lines of code with this! Well done sir!
But, of course, (there's always a but)... I am having a problem that is escaping me.
When a server-side query (returning json) is < the total iDisplayLength, I seem to get the row "header" (first row, counted in the _END_ variable (DataTables 1.7.1)
ex: iDisplayLength=10 "Showing 1 to 6 of 5 entries" (when I "filter" to 1 row being returned I get: "Showing 1 to 2 of 1 entries")
(This works fine if iDisplayLength=10 and 10 or more rows are returned)
The iTotalRecords and iTotalDisplayRecords are fine, pagination works fine, expand to detail works fine, server-side searching on multiple columns works fine, my wife's generally happy, and my kids think I'm a geek.
But my counter, she no good... I'd appreciate any pointers you might have.
Thanks in advance!
Dan
But, of course, (there's always a but)... I am having a problem that is escaping me.
When a server-side query (returning json) is < the total iDisplayLength, I seem to get the row "header" (first row, counted in the _END_ variable (DataTables 1.7.1)
ex: iDisplayLength=10 "Showing 1 to 6 of 5 entries" (when I "filter" to 1 row being returned I get: "Showing 1 to 2 of 1 entries")
(This works fine if iDisplayLength=10 and 10 or more rows are returned)
The iTotalRecords and iTotalDisplayRecords are fine, pagination works fine, expand to detail works fine, server-side searching on multiple columns works fine, my wife's generally happy, and my kids think I'm a geek.
But my counter, she no good... I'd appreciate any pointers you might have.
Thanks in advance!
Dan
This discussion has been closed.
Replies
ex: iDisplayLength=10 ==> I get "Showing 1 to 6 of 5 entries" with 5 rows of data being returned (along with the header row in the json) (Or aother example: when I "filter" to 1 row of real data being returned, I get: "Showing 1 to 2 of 1 entries")
Sorry,
Dan
Could you paste in the JSON that your server-side process is returning please? I suspect that iTotalRecords and / or iTotalDisplayRecords might be slightly off.
Thanks,
Allan
My apologies for wasting your time.
Thanks,
Dan
"Filtering" to 1 row I get the following.
Displayed from .datatable():
"Showing 1 to 2 of 1 entries (filtered from 3,725 total entries)"
json here:
{"sEcho": 2, "iTotalRecords": 3725, "iTotalDisplayRecords": 1, "aaData": [["Expand","ISIR_KEY","Student SSN","Student Name","Last Name","First Name","DOB","Source Reason","Imported","Reject C","Reject T","Reject E","Reject F","Reject R","Reject D","Reject N","Reject I","Reject P","Reject S","Reject V","Reject G","New\/
Rejects"], ["","598160","400300711<\/a>","Arnold, Corp ","Arnold","Corp","25-AUG-1972","Federal
","06-JAN-2010","Correction pending","Corrections transmitted","Earlier record","Federal Lock","Federal Reject","Data error","No name","No SSN","Student packaged","Status too low","Student verified",null,"New
Rejects exist"] ] }
two part error (on my part)
1) The REAL reason the count was off, my interpretation of the requirements of the server-side json data was off, I was returning column headers in every page of returned rows. I've switched to sTitle for column headers and no title row in returned page data. MUCH better! (fixes the counts).
2) In hooking up the filtering/paging to Oracle, my translation of mySQL LIMIT to Oracle row_number() logic was off to complicate matters further.
All my mistake(s).
Thanks for a great tool!
Dan