Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Do you want to tell that for each row we have a column who have two buttons : edit and delete and when you click of them you do an action what you described ?</p> <p>If yes,</p> <h2><a href="http://jsfiddle.net/sThGk/101/" rel="nofollow noreferrer">DEMO</a> jsFiddle</h2> <p>you should do something like this :</p> <p>first, create a form with your buttons and in your form, you are your datatable :</p> <p>Ex:</p> <h3>html</h3> <pre><code>&lt;form type="post"&gt; &lt;div&gt;&lt;input id="button" type="button" value="delete" /&gt;&lt;/div&gt; &lt;div class="container"&gt; &lt;table cellpadding="0" cellspacing="0" border="0" class="dataTable" id="example"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Select&lt;/th&gt; &lt;th&gt;Rendering engine&lt;/th&gt; &lt;th&gt;Browser&lt;/th&gt; &lt;th&gt;Platform(s)&lt;/th&gt; &lt;th&gt;Engine version&lt;/th&gt; &lt;th&gt;CSS grade&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;span&gt;&lt;input name="row_1" type="checkbox" value="id1" /&gt;&lt;/span&gt;&lt;/td&gt; &lt;td&gt;Trident&lt;/td&gt; &lt;td&gt;Internet Explorer 4.0&lt;/td&gt; &lt;td&gt;Win 95+&lt;/td&gt; &lt;td&gt; 4&lt;/td&gt; &lt;td&gt;X&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <h3>javascript</h3> <pre><code>var oTable = $('#example').dataTable(); $('#button').click(function() { alert(JSON.stringify($('form').serialize())); //do you post here example : //$.ajax({ // url:base_url+'admin/articles/delete/', // data: $('form').serializeArray(), // or $('form').serialize() // type:'POST', // dataType:'json' //}).done(function(data){ //if (data) //{ // block.fadeOut('slow'); //} //else //{ // alert('there was an error, please try again'); //} //}); }); </code></pre> <p>Is that it helped you?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload