Server Side Processing and Column Rendering

Server Side Processing and Column Rendering

ian.mooneian.moone Posts: 3Questions: 0Answers: 0
edited January 2011 in General
Hi! I want to thank the man behind this awesome project... just found out about it 2 days ago.

Anyways, I recently followed the example on server side processing demo 'cause the result is more than 150k rows.. and now I'm stuck on displaying the correct format for date and price and putting links. I want to make my Date [23-Jan-2010] instead of the original [2010-01-23] and Price in 2 decimal places instead of the original 4. I have no problem when it's not server-side processing since I control the formats via PHP when I include the file in the tabs.

I hope somebody would help or guide me to achieve this.

Here is my code

[code]
$('#prices_tbl').dataTable({
"bJQueryUI" : true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "sTitle": "Date", "sClass": "text-center", "asSorting": [ "desc" ] },

{ "sTitle": "Stock Symbol", "sClass": "text-center" },

{ "sTitle": "Price", "sClass": "text-center",
"sType": 'numeric'

}

],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../ajax/pricelist.php"
});
[/code]

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    There are basically two options - you could use fnRender to render the columns you want (take the text from the server and manipulate it into the display form), or you can just return the required format from the PHP script. It's basically a choice between doing it on the client-side and on the server-side - it's up to you :-)

    On the server-side you want to d something a bit like shown in the demo script, line 161 - http://www.datatables.net/development/server-side/php_mysql . On the client-side, as I say, fnRender is the answer.

    Allan
  • ian.mooneian.moone Posts: 3Questions: 0Answers: 0
    Man... I feel stupid! Weew! I'm more comfortable coding on the server-side. It is now working!

    Thanks Allan for your help!^^
This discussion has been closed.