SSP (server side processing) - how to manipulate the columns Array ?

SSP (server side processing) - how to manipulate the columns Array ?

mDdatatablemDdatatable Posts: 2Questions: 1Answers: 0
edited August 2018 in Free community support

I'm using datatable for years - and love it.

BUT, now I'm running in troubles which drives me crazy. I spend hours on this, so I try to get help here. I would love to solve this with datatable server side processing, which is so much faster than the client way, which makes me love datatable even more.

Let me explain by an simple example. I have a user table with thousand of entries.

tablename: user

example row:
id: 99999
fname: Jimmy
lname: Hendrix
group: Music

this final table row should look like this

  <td class="someClass1"><a href="page?id=1">99999</a></td>
  <td class="someClass2">
    <a href="user?id=99999">Hendrix, Jimmy</a>

as dt(0) is easy and works i don't know how to syntax dt(1)
how can I achieve this within the columns Array ?

$pdoCols = array(
  array('db' => 'id', 'dt' =>  0, 'formatter' => function($d, $row) { if($d) return '<a href="user?=' . $d . '">' . $d . '</a>'; }),
  array('db' => '??', 'dt' =>  1), // What to do here ?

I would be so thankful for any help.


  • allanallan Posts: 49,474Questions: 1Answers: 7,275 Site admin

    Hi George,

    I would actually suggest you use columns.render rather than the PHP formatter function here. Have your PHP return the raw data from the database, and you still get all the speed benefits of server-side processing, but use renderers on the client-side to handle the final output transformation. That makes it easy to display combined fields and also has a performance benefit that DataTables doesn't need to strip out the HTML for thing like the number sort.


  • mDdatatablemDdatatable Posts: 2Questions: 1Answers: 0

    thank you su much for your response, allan. i will give this a try and give feedback here again.

Sign In or Register to comment.