JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<link rel="stylesheet" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<table id="listado-atenciones" class="easyui-datagrid" title="Listado de Atenciones" style="display: none;">
<thead>
<tr>
<th data-options="field: 'id', hidden: true">ID</th>
<th data-options="field: 'fecha', width: 100, sortable: true, resizable: false, align: 'center'">
Fecha<br>
<input type="text" id="filtro-fecha" class="filtro">
</th>
<th data-options="field: 'hora', width: 100, sortable: true, resizable: false, align: 'center'">
Hora<br>
<input type="text" id="filtro-hora" class="filtro">
</th>
<th data-options="field: 'nombre', width: 180, sortable: true, resizable: false">
Cliente/Contacto<br>
<input type="text" id="filtro-nombre" class="filtro">
</th>
<th data-options="field: 'tipo', width: 80, sortable: true, resizable: false, align: 'center'">
Tipo<br>
<input type="text" id="filtro-tipo" class="filtro">
</th>
<th data-options="field: 'estado', width: 120, sortable: true, resizable: false, align: 'center'">
Estado Actual<br>
<input type="text" id="filtro-estado" class="filtro">
</th>
<th data-options="field: 'motivo', width: 180, sortable: true, resizable: false">
Motivo<br>
<input type="text" id="filtro-motivo" class="filtro">
</th>
</tr>
</thead>
<tbody>
<tr>
<td>31</td>
<td>25/07/2013</td>
<td>07:42:19 PM</td>
<td>Horacio Santana</td>
<td>Teléfono</td>
<td>Derivada a Ventas</td>
<td>Atención al Cliente</td>
</tr>
<tr>
<td>29</td>
<td>25/07/2013</td>
<td>07:41:26 PM</td>
<td>Pedro Picapiedra</td>
<td>Presencial</td>
<td>Derivada a Ventas</td>
<td>Atención al Cliente</td>
</tr>
<tr>
<td>30</td>
<td>25/07/2013</td>
<td>07:41:26 PM</td>
<td>Pedro Picapiedra</td>
<td>Presencial</td>
<td>Derivada a Ventas</td>
<td>Atención al...
JavaScript
$( '#listado-atenciones' ).datagrid({
height: 660,
autoRowHeight: false,
rownumbers: true,
fitColumns: true,
singleSelect: true,
autoRowHeight: false,
remoteSort: false
});
/* filtrar registros */
$( document ).on( 'keyup', '.filtro', function() {
// $( '#listado-atenciones' ).datagrid(); //// this makes me lose my previous entered filter criteria
var filtrados = new Array();
var filtro = $( this ).val();
var campoFiltro = $( this ).closest( 'td' ).attr( 'field' );
var registros = $( '#listado-atenciones' ).datagrid( 'getRows' );
for ( var i = 0; i < registros.length; i++ ) {
if ( registros[ i ][ campoFiltro ].toLowerCase().indexOf( filtro.toLowerCase() ) != -1 ) {
filtrados.push( registros[ i ] );
}
}
$( '#listado-atenciones' ).datagrid( 'loadData', filtrados );
console.log(filtrados);
});
/* prevenir la funcionalidad de sorting al entrar a los campos de filtros */
$( '.filtro' ).click( function( event ) {
if ( event.stopPropagation ) {
event.stopPropagation(); // W3C
}
else {
event.cancelBubble = true; // IE
}
});