<filename>params.json<gh_stars>0
{"name":"Datatables - Custom Sorting","tagline":"Custom sorting input elements for Datatables 1.9.4 and jQuery 1.9.1","body":"Datatables - Custom Sorting\r\n===========================\r\n\r\n> This is an example of how to implement custom sorting for HTML input elements with [DataTables 1.9.4](http://legacy.datatables.net/ref) and [jQuery 1.9.1](http://jquery.com/).\r\n\r\nUsage\r\n-----\r\n\r\n<ol>\r\n<li>Put jQuery and DataTables scripts in your page.\r\n<p>\r\n<pre><code>&lt;script src=\"path/to/jquery.min.js\"&gt;&lt;/script&gt;\r\n&lt;script src=\"path/to/jquery.dataTables.js\"&gt;&lt;/script&gt;</code></pre>\r\n</p>\r\n<p>How to use and style? Check the <a href=\"http://datatables.net\">DataTables</a> website. But remember that we are using the 1.9.4 version. So, check the <a href=\"http://legacy.datatables.net/ref\">docs of the legacy API</a>.</p>\r\n</li>\r\n<li>Put the custom sorting javascript file after dataTables.js file.\r\n<p>\r\n<pre><code>&lt;script src=\"path/to/dataTables.customSorting.js\"&gt;&lt;/script></code></pre>\r\n</p>\r\n</li>\r\n<li>Set your table markup.\r\n<p>\r\n<pre><code>&lt;table&gt;\r\n    &lt;thead&gt;\r\n        &lt;tr&gt;\r\n            &lt;th&gt;Product Name&lt;/th&gt;\r\n            &lt;th&gt;Warranty Lost?&lt;/th&gt;\r\n        &lt;/tr&gt;\r\n    &lt;/thead&gt;\r\n    &lt;tbody&gt;\r\n        &lt;tr&gt;\r\n            &lt;td&gt;Remote Controlled Car&lt;/td&gt;\r\n            &lt;td&gt;&lt;input type=\"checkbox\" value=\"true\"&gt;&lt;/td&gt;\r\n        &lt;/tr&gt;\r\n    &lt;/tbody&gt;\r\n&lt;/table&gt;</code></pre>\r\n</p>\r\n</li>\r\n<li>Now setup the DataTables plugin with these options.</li>\r\n<pre><code>$('table').dataTable({\r\n    \"aoColumns\": {\r\n        null,\r\n        \"sSortDataType\": \"checkbox\"\r\n    }\r\n});</code></pre>\r\n<p>You must set an option called <code>aoColumns</code> to the DataTables setup. Each property of it represents the <code>th</code> of the table element.</p>\r\n<p>Where you want the default sorting behavior of DataTables, set null for that property. And for a custom sorting, set the <code>sSortDataType</code> property with a valid custom sorting type: <code>checkbox</code>, <code>radiobutton</code> or <code>select</code>.</p>\r\n<li>That's it! Now you can sort the column of the example with checkboxes.</li>\r\n</ol>","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}