2
votes

I'm planning to use datatables to retrieve all my user data from a mysql table and display them . I'm using their server-side processing code to retrieve all data . I've a requirement where certain additional columns that require custom value to be inserted .

$('#data').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "userlist.php"
} );

In server side processing,

$aColumns = array('col1', 'col2', 'col3');

Actual columns to be displayed,

<th>col1</th>
<th>col2</th>
<th>col3</th>
<th>col4</th>

where col4 contains an example code like ,

<a href='del.php?userid=col1value></a>

How can i accomplish this ?

Refer : http://datatables.net/examples/server_side/server_side.html

1

1 Answers

2
votes

all you need to do is send the fourth column as HTML tag, and it will work for example while returning the value from serverside

$aColumns = array('col1', 'col2', 'col3', "<a href='del.php?userid=col1value>sometext</a>");

and it will work :).

P.S: you can return anything from server side, it can be HTML tags or a string, datatables will place the value inside of your column without any problem.