Haiti portal problems
Haiti portal problems
![flavour](https://secure.gravatar.com/avatar/c6ddf97a6d7481cbc27db42f487d98ef/?default=https%3A%2F%2Fvanillicon.com%2Fc6ddf97a6d7481cbc27db42f487d98ef_200.png&rating=g&size=120)
I have set up a portal which is actively aggregating data for the Haiti disaster response:
http://haiti.sahanafoundation.org/
This uses dataTables for client-side pagination/search/sort
Due to the increased # of records & users,we really need to move to server-side pagination:
http://trac.sahanapy.org/wiki/ServerSidePagination
I've found 2 problems with this, the 1st of which I've solved, but the 2nd I have yet to solve, despite pulling my 1nd all-nighter ;)
The 1st issue is that we have many null columns & so we got sData = null causing the javascript to not complete.
In the _oExt.aTypes fucntion (sData) I wrapped a check to fix that:
if ( sData !== null && sData !== '' ) {
The 2nd issue is that the 2nd page doesn't load:
* 1st page loads correctly - showing 10 records from xxx
* click to get the next screen & the JSON loads correctly (as shown by Firefox) yet it gets stuck on 'Processing'...no javascript error visible.
* all works fine if I set "bServerSide": false & keep sAjax on.
Here is the 2nd page's JSON:
{"aaData": [[11, "erjnetyjmnhy", null, null, null, null, "", "", "", "", null, "", null, null, null, "", "", null], [12, "drjnetyjmnymet", null, null, null, null, "", "", "", "", null, "", null, null, null, "", "", null], [13, "gweqgwerh", null, null, null, null, "", "", "", "", null, "", null, null, null, "", "", null]], "iTotalRecords": 3, "iTotalDisplayRecords": 13, "sEcho": 1}
I reverted to a clean 1.56 & then downgraded to 1.54 to see if the problem would go away but it didn't.
The same patch was also needed for sData.
NB We also have other issues.
1st we had this one which was solved through a patch:
https://bugs.launchpad.net/sahana/+bug/508165
But now we have new ones which I've not yet had time to see whether are due to the patch or what:
http://trac.sahanapy.org/ticket/35
http://trac.sahanapy.org/ticket/74
Any volunteers to help resolve this issue would be much appreciated!
Many thanks,
Fran.
http://haiti.sahanafoundation.org/
This uses dataTables for client-side pagination/search/sort
Due to the increased # of records & users,we really need to move to server-side pagination:
http://trac.sahanapy.org/wiki/ServerSidePagination
I've found 2 problems with this, the 1st of which I've solved, but the 2nd I have yet to solve, despite pulling my 1nd all-nighter ;)
The 1st issue is that we have many null columns & so we got sData = null causing the javascript to not complete.
In the _oExt.aTypes fucntion (sData) I wrapped a check to fix that:
if ( sData !== null && sData !== '' ) {
The 2nd issue is that the 2nd page doesn't load:
* 1st page loads correctly - showing 10 records from xxx
* click to get the next screen & the JSON loads correctly (as shown by Firefox) yet it gets stuck on 'Processing'...no javascript error visible.
* all works fine if I set "bServerSide": false & keep sAjax on.
Here is the 2nd page's JSON:
{"aaData": [[11, "erjnetyjmnhy", null, null, null, null, "", "", "", "", null, "", null, null, null, "", "", null], [12, "drjnetyjmnymet", null, null, null, null, "", "", "", "", null, "", null, null, null, "", "", null], [13, "gweqgwerh", null, null, null, null, "", "", "", "", null, "", null, null, null, "", "", null]], "iTotalRecords": 3, "iTotalDisplayRecords": 13, "sEcho": 1}
I reverted to a clean 1.56 & then downgraded to 1.54 to see if the problem would go away but it didn't.
The same patch was also needed for sData.
NB We also have other issues.
1st we had this one which was solved through a patch:
https://bugs.launchpad.net/sahana/+bug/508165
But now we have new ones which I've not yet had time to see whether are due to the patch or what:
http://trac.sahanapy.org/ticket/35
http://trac.sahanapy.org/ticket/74
Any volunteers to help resolve this issue would be much appreciated!
Many thanks,
Fran.
This discussion has been closed.
Replies
sEcho should be repeated back as-is & not using a fixed value...docs here could be improved (I was give a poor example by a friend on this part)
The bug reported still stands...there's a typo just underneath it too in the comment.
Now I have to figure out Search & Sorting.
One of the 1 bugs did seem to be due to the plugin installed to fix ID sorting.
So there's still plenty of dataTables work to do if anyone can please spare some time!
Many thanks,
Fran.
God to hear you got the pagination sorted. The server-side usage page does note ( http://datatables.net/usage/server-side ): string: sEcho - An unaltered copy of sEcho sent from the client side. Note that it strongly recommended for security reasons that you 'cast' this parameter to an integer in order to prevent Cross Site Scripting (XSS) attacks.
Regarding the searching and sorting - when using server-side processing, they are both performed at the server-side - typically in SQL. This link will be of some use to you if you haven't seen it already: http://datatables.net/examples/data_sources/server_side.html
Anything else we can do to help - just shout!
Regards,
Allan
Already 'casting' as int()
With the simple use-case of a single-column to sort, the rest shouldn't be /too/ hard ;)
F