Search/Show entries and pagination not working correctly
Search/Show entries and pagination not working correctly
mattmillen
Posts: 10Questions: 0Answers: 0
Hi There,
I think this is a great plugin by the way. I have nearly done everything i wanted to with it however i have a few outstanding issues if you could help please.
http://www.cfolending.net/securelogin/
username: temp
password: 8C3TUdav
the search filter and show number of entries just wont go on one line and does when data is calling local data and not from the database? any ideas why? Am i missing something? as the pagination does not work correctly either.
Also i need to add the search date range function. how do i do this? would this just be a query for that date?
I have marked up here the issues.
http://www.cfolending.net/leadsexample.jpg
Debug code here: aheyik
This is also an example of how it should look with local data pulled in. just so you can see i have had it working
http://www.cfolending.net/example
Thanks in advance if you can help as im nearly there!
I think this is a great plugin by the way. I have nearly done everything i wanted to with it however i have a few outstanding issues if you could help please.
http://www.cfolending.net/securelogin/
username: temp
password: 8C3TUdav
the search filter and show number of entries just wont go on one line and does when data is calling local data and not from the database? any ideas why? Am i missing something? as the pagination does not work correctly either.
Also i need to add the search date range function. how do i do this? would this just be a query for that date?
I have marked up here the issues.
http://www.cfolending.net/leadsexample.jpg
Debug code here: aheyik
This is also an example of how it should look with local data pulled in. just so you can see i have had it working
http://www.cfolending.net/example
Thanks in advance if you can help as im nearly there!
This discussion has been closed.
Replies
Good to hear that you are nearly there with your DataTables integration! I've just tried the page, but I'm getting a login error with the credentials from above I'm afraid.
Regarding the alignment of the search and filter input - this is probably a CSS issue, that I'll be able to help you with when I can access the page. I'll try it again in a little while.
Regarding the date range filtering - since you are using server-side processing, you'll need to send the dates to the server, so the script can take these into account in the processing of the data and calculating what the client-side should show. To do that, you would use fnServerParams:
[code]
fnServerParams: function ( d ) {
d.push( { "name": "startDate", "value": $('#startDate').val() } );
d.push( { "name": "endDate", "value": $('#endDate').val() } );
}
[/code]
(updating the parameter names as required of course!). That will send the PHP script which you can then access using `$_REQUEST['stateDate']` etc, and append as WHERE conditions to the SQL that the script generates.
Finally regarding the paging - your server-side script is only returning 1 row at the moment, so it might well actually be working, but since there is only one row, the paging controls are disabled. It doesn't look quite correct in its styling - is that the problem you are looking at rather than actually going to the next page?
Regards,
Allan
username: matt.millen@intentideas.com
password: 6TFEeNK5ejg526d
then login and look you will see what i mean
I think something has gone wrong int he plugin.css file. It has:
[code]
.dataTables_length, .dataTables_filter{padding: 15px;left
float: left;}
[/code]
I think you want:
[code]
.dataTables_length,
.dataTables_filter{
padding: 15px;
}
.dataTables_length {
float: left;
}
[/code]
Regards,
Allan
Please see this one.
http://www.cfolending.net/securelogin/
username: matt.millen@intentideas.com
password: 6TFEeNK5ejg526d
This was an example of it working fine.
http://www.cfolending.net/example/
this example call the data locally where as the one above calls via database. please see http://www.cfolending.net/securelogin/
I've just tried the paging not he securelogin/ page and it actually appears to work okay for me. It doesn't show the page numbers as the sPaginationType hasn't been set (it was `sPaginationType: 'full_numbers'` in the other example).
Also, I notice in the server-side processing return there is:
> "iTotalRecords":"15","iTotalDisplayRecords":"15"
These should be integers rather than string values. It doesn't look like what is causing the problem, but it won't help much either :-).
Regards,
Allan
DataTables warning (table id = 'datatable'): Cannot reinitialise DataTable.
To retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy
Also when you mention "iTotalRecords":"15","iTotalDisplayRecords":"15" not being integer where would i change this value?
[code]
$(document).ready(function() {
$("#datatable").dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "table.php"
} );
} );
[/code]
currently.
Regarding the integers: It would be in your server-side script (table.php) the assignment of those two parameters could just be wrapped in `intval()` - i.e. `"iTotalRecords" => intval( $totalRecords )` - or however your script is made up!
Regards,
Allan
Any ideas why
Please see this one.
http://www.cfolending.net/securelogin/
username: matt.millen@intentideas.com
password: 6TFEeNK5ejg526d
I created a debug for you also: exafud
if i add this it breaks and not data shows:
$(document).ready(function() {
$("#datatable").dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "table.php"
"sPaginationType": "full_numbers"
} );
} );
if i i remove "sPaginationType": "full_numbers"
$(document).ready(function() {
$("#datatable").dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "table.php"
} );
} );
it is then ok again however pagination still does not work? Where am i going wrong?
[code]
$(document).ready(function() {
$("#datatable").dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "table.php",
"sPaginationType": "full_numbers"
} );
} );
[/code]
Regards,
Allan