javascript - Datatables fix second row -
i started using datatables tables. have table customers. first row table header. second row button add new customer. rest of rows list of customers.
i want datatables sort not "new customer" row. how lock row / exclude sorting?
tried this:
<table class="muitable" border="0" cellpadding="0" cellspacing="3" id="customertable"> <thead> <tr> <th> </th> <th> </th> <th class="muitable bluehover hand" > name </th> <th class="muitable bluehover hand" > created </th> <th class="muitable bluehover hand" > status </th> </tr> <tr> <th width="16"> </th> <th class="muitable hovernextcell" onclick="newcustomer()"> <img src="/common/images/plus.png" width="16" height="16" class="hand"> </th> <th class="muitable bluecell"> new customer </th> <th colspan="2"> </th> </tr> </thead> <tbody> --contents-- </tbody> </table>
the problem arises "sorting buttons" on place. when there value in cell on second row, becomes button, if theres not, uses first row making sorting button.
how tell datatables leave second th row alone , use first row headers?
you can put "add customer" button in header. this:
<thead> <tr> <th>column 1</th> <th>column 2</th> <th>etc</th> </tr> <tr> <th colspan="3"> <button>add customer</button> </th> </tr> </thead>
now datatables not sort row.
jsfiddle: http://jsfiddle.net/fd3ed/
Comments
Post a Comment