Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
    
Hi, the array in acolums denote column name in mysql so i think i cannot write html code there. –  Ajay May 19 '12 at 16:59
    
I ended up uisng mDataProp. Thanks for your help. –  Ajay May 19 '12 at 18:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.