Thanks for your e-mail - yes I agree. I think the newlines are what is causing the issue here. Try replacing them in your PHP with just a space and hopefully it will then all start to magically work :-)
Reviewing your anwers...
>> The json output looks fine, as does the PHP - so I guess I'm missing something on my read through. The only thing I'm wondering about is where is the "sLimit" variable on the SQL query...
Now I see all pages but I'm still in problems... other problems. With fnRowCallback I set the 'id' to TR and TD, and set the CSS classes, anything of that is printed.
In addition, if add fnServerData, the datatable isn't printed.
Ah ha! Those pesky \n and \r's... Always getting in the way. Nice one getting that sorted.
I'm not sure I understand your second comment though. Looking at your page the ID's of the TDs are being set correctly are they not?
Also if fnServerData() isn't displaying anything, then you probably aren't calling the call back function correctly. Have a look at the demo page and see if there is any difference to your code.
Allan, I've just got set the IDs. Before use sAjaxSource I use fnUpdate+fnDraw to refresh datatable with the news values edited but now the fields aren't refreshed. How can I refresh the datatable with the new datas???
The same problem I have when I create a new row with fnAddData. Since I use sAjaxSource it doesn't work.
So, working with server-side, how can I redraw the edited and new rows????
With server-side processing most of the API functions which manipulate data will not work - the simple reason is that they all work on the client-side and not the server. Server-side programming and vary greatly from platform to platform (even on the same platform) and adding this kind of thing into the API functions would be far to constrictive, so it's up to the developer to manipulate the data on the client-side and communicate this to the server-side.
Taking the addition of data to a table as an example, what you will need to do is send the new data you want to be added to the server, it will then add it to isn't database (or do whatever it needs to do) and then call fnDraw() on the client-side to get the updated information from the server-side's database.
It might be worth reviewing the various server-side processing examples that I've put up: http://datatables.net/1.5-beta/examples/server_side/server_side.html
You can - you can do everything you want to do with the server-side processing, it just takes a bit more effort. All your updates need to be sent to the server and then the table redrawn (you can update the table live, but that is even more complexity).
Refreshing the table with server-side processing is simply a case of calling fnDraw() (it will pull updated information from the server).
Allan, if I add the next to datatable definition, the table stand by "Processing..." and doesn't print it. I just want to get the iDisplayLength and iDisplayStart. What's wrong???
"fnServerData": function ( sSource, aoData, fnCallback ) {
for (i=0;i
You aren't using the callback function (it needs to be called with the data that you have got from the server) and you don't actually do anything to get new data from the server.
Take a look at this example: http://datatables.net/1.5-beta/examples/server_side/post.html
Allan, my datatable is now working fine. But I have a last question.
After this change you said me for seeing an image instead of "Loading..."
//oSettings.nProcessing.appendChild( document.createTextNode( oSettings.oLanguage.sProcessing ) );
oSettings.nProcessing.innerHTML = oSettings.oLanguage.sProcessing;
I see it with a border and I would like to take it out. It is possible???
The border on the processing element is a nice easy one to fix - have a look in my demo css file for a style class of 'dataTables_processing'. You will see it has a border - just rip this line out.
Firebug is a Firefox extension which makes this kind of thing exceptionally easy to find and fix. Webkit's Web Inspector does the same job in Safari / Chrome.
Replies
Att.
Jorge.
Allan
$comments=str_replace("\n"," ",$aRow['Comentarios']);
$comments=str_replace("
"," ",$aRow['Comentarios']);
You can refresh the URL again to see the first pages is the only one that is printed on web :(
Att.
Jorge.
"fnServerData": function ( sSource, aoData, fnCallback ) {
...............
}
It cannot run... again!!!! :'(
Att.
Jorge.
>> The json output looks fine, as does the PHP - so I guess I'm missing something on my read through. The only thing I'm wondering about is where is the "sLimit" variable on the SQL query...
What do you mean???? I used your example:
/* Paging */
$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) )
{
$sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
mysql_real_escape_string( $_GET['iDisplayLength'] );
}
Att.
Jorge.
$comments=str_replace("\r","",$comments);
Now I see all pages but I'm still in problems... other problems. With fnRowCallback I set the 'id' to TR and TD, and set the CSS classes, anything of that is printed.
In addition, if add fnServerData, the datatable isn't printed.
Att.
Jorge.
I'm not sure I understand your second comment though. Looking at your page the ID's of the TDs are being set correctly are they not?
Also if fnServerData() isn't displaying anything, then you probably aren't calling the call back function correctly. Have a look at the demo page and see if there is any difference to your code.
Allan
Att.
Jorge.
So, working with server-side, how can I redraw the edited and new rows????
Att.
Jorge.
Taking the addition of data to a table as an example, what you will need to do is send the new data you want to be added to the server, it will then add it to isn't database (or do whatever it needs to do) and then call fnDraw() on the client-side to get the updated information from the server-side's database.
It might be worth reviewing the various server-side processing examples that I've put up: http://datatables.net/1.5-beta/examples/server_side/server_side.html
Allan
Att.
Jorge.
Refreshing the table with server-side processing is simply a case of calling fnDraw() (it will pull updated information from the server).
Allan
"fnServerData": function ( sSource, aoData, fnCallback ) {
for (i=0;i
Take a look at this example: http://datatables.net/1.5-beta/examples/server_side/post.html
Allan
After this change you said me for seeing an image instead of "Loading..."
//oSettings.nProcessing.appendChild( document.createTextNode( oSettings.oLanguage.sProcessing ) );
oSettings.nProcessing.innerHTML = oSettings.oLanguage.sProcessing;
I see it with a border and I would like to take it out. It is possible???
Jorge.
Sounds like you are nearly there - nice one.
The border on the processing element is a nice easy one to fix - have a look in my demo css file for a style class of 'dataTables_processing'. You will see it has a border - just rip this line out.
Firebug is a Firefox extension which makes this kind of thing exceptionally easy to find and fix. Webkit's Web Inspector does the same job in Safari / Chrome.
Hope that helps,
Allan
Jorge.
Thanks.
Jorge.
I think:
[code]
$('#{_TABLE_ID_}_filter input').focus();
[/code]
should do that for you.
Allan
Jorge.
[code]
$('#{_TABLE_ID_}_filter input')[0].focus();
[/code]
And remember to change "{_TABLE_ID_}" to whatever is needed.
Allan
Thank you very much.
Jorge.