javascript - Datatable not giving proper search result -




working on html table using data tables , in 1 column have input button wrapped in div

for column search option not working

please let me know doing wrong

html code

<table id="pointsonrole" class="display" cellspacing="0">     <thead>         <tr>             <th>name</th>             <th>email</th>             <th>role</th>         </tr>     </thead>     <tbody>         {% emp in emps %}         <tr>             <td>{{emp.employee.user.first_name}} {{emp.employee.user.last_name}}</td>             <td>{{emp.employee.user.email}}</td>             <td>                  <div class="flipswitch">                     {% if emp.role == 'admin' %}                     <input type="checkbox" data-csrf="{{ csrf_token }}" data-role="admin" data-first="{{emp.employee.user.first_name}}" data-last="{{emp.employee.user.last_name}}" data-id="{{emp.employee.id}}" name="flipswitch" class="flipswitch-cb" id="{{emp.employee.user.email}}" checked="checked"">                     {% else %}                     <input type="checkbox" data-csrf="{{ csrf_token }}" data-role="user" data-first="{{emp.employee.user.first_name}}" data-last="{{emp.employee.user.last_name}}" data-id="{{emp.employee.id}}" name="flipswitch" class="flipswitch-cb" id="{{emp.employee.user.email}}">                     {% endif %}                     <label class="flipswitch-label" for="{{emp.employee.user.email}}">                         <div class="flipswitch-inner"></div>                     </label>                 </div>              </td>         </tr>         {% endfor %}     </tbody> </table> 

javascript :

    jquery.fn.datatable.ext.type.search.hiddenval = function(data) {        return $('<div>').append(data).find('.flipswitch-cb').text()     };      $('#pointsonrole').datatable( {         "paginglength": "10",         "orderable": false,         "searchable": false,         "columndefs": [            { type: "hiddenval", targets: [2] } //role column         ]     }); 

button used in html : button link





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -