0

I am using DataTables and would like to create the table dynamic from js according to the following example:

http://datatables.net/release-datatables/examples/data_sources/js_array.html

How can i still use this API if i want to create some more complex rows such as

  <tr>
    <td><div class="checksquared"><input type="checkbox" name="checkbox[]" /><label></label></div></td>     
    <td>Title Name</td>
    <td>18769</td>
    <td>
        <span class="checkslide">
            <input type="checkbox" checked="checked" />
            <label data-on="On" data-off="Off"></label>
        </span>
    </td>
    <td>
      <span class="tip" ><a href="modalEdit.html?idEdit=edit" class="pop_box" title="Edit" ><img src="images/icon/icon_edit.png" ></a></span> 
      <span class="tip" ><a href="javascript:void(0)" class="Delete" data-name="delete name" title="Delete"><img src="images/icon/icon_delete.png" ></a></span> 
     </td>
  </tr>

EDIT: my server side is ASP.NET

2 Answers 2

0

I think what you are looking for is the function mRender (http://datatables.net/ref#mRender) It allows for returning whatever you wish (HTML in your case) and you have access to the whole row.

You could e.g. use this:

"mRender": function ( data, type, full ) {
    return '<span class="checkslide"> <input type="checkbox" checked="checked" value='+data+' /><label data-on="On" data-off="Off"></label></span>';
}
0

Might this can help... http://datatables.net/release-datatables/examples/server_side/server_side.html

in the link inside of Server side (PHP) code you modify your customized row as per your need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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