Dynamically add columns with multiselect filter
Dynamically add columns with multiselect filter
Hi all,
I would like to apply multiselect filter to awesome datatables ! I would prefer multiselect : http://wenzhixin.net.cn/p/multiple-select/docs/.
I did by using my sample code :
<thead>
<tr>
<th>
StudentID
</th>
<th>
FirstName 2
</th>
<th>
LastName
</th>
<th>
StudentID
<br />
<select data-placeholder="ID" id="idSelect" multiple="multiple" style="width:auto;">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
</th>
<th>
FirstName 2
</th>
<th>
LastName
</th>
</tr>
</thead>
Everyhing is fine, but I would like to create "dynamically add" new columns, so I should be able to add new <th> with multiselect data.
I do not know how should I do this.
I thought that I use $(#id).append('<th><select....</select></th>'), but when I do this, it is problem with "Css styles", and multiselect does not look like original without "append" function.
Could you help me how can I do multiselect filter connected with dynamically column adding ?
Please, help me.