数据表搜索列

时间:2012-11-01 23:28:28

标签: jquery symfony datatables

我正在使用datatables插件,当你扫描intentto时我遇到了问题。按照本页所述的列进行搜索:

http://jquery-datatables-column-filter.googlecode.com/svn/trunk/external.html

问题是我想要过滤数据不仅包含文本数字,所以我曾想过用数字创建一个隐藏的列,但我的工作方式是这样的:

tablalistaproductos = $('#tablalistaproductos').dataTable( {
    "bJQueryUI": true,  
    "sScrollY": "450px",
    "bPaginate": false, 
    "bScrollCollapse": true,            
    "oLanguage": espanol,
    "aoColumns": [null,null,null,{ "bVisible":false},null,null,null,null,null,null,null,null]
    })

<table cellpadding="0" cellspacing="0" border="0" class="display" id="tablalistaproductos">
  <thead>
    <tr>
            <th>Id</th>
            <th>Descripcion</th>
            <th>Stock</th>
            <th>Stockoculto</th>
            <th>Stockreservado</th>
            <th>Precio venta</th>
            <th>Precio compra</th>
            <th>Marca</th>
            <th>Iva</th>
            <th>Familia</th>
            <th>Proveedor</th>
            <th>Acciones</th>

    </tr>
  </thead>

  <tbody>
      {% for entity in entities %}

    <tr>
            <td><a href="{{ path('producto_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
            <td>{{ entity.descripcion }}</td>
            <td>{{ entity.stock }} unidades</td>
            <td>{{ entity.stock }}</td>
            <td>{{ entity.stockreservado }} Unidad/es</td>
            <td>{{ entity.pventa }} €</td>
            <td>{{ entity.pcompra }} €</td>
            <td>{{ entity.marca }}</td>
            <td>{{ entity.iva }} %</td>
            <td>{{ entity.familia }}</td>
            <td> {{ entity.proveedor}}</td>
            <td><div class="boton" id="editarproducto">Editar</div></td>

        </tr>
  {% endfor %}
 </tbody>

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。我用了colvis():

tablalistaproductos = $('#tablalistaproductos').dataTable( {
    "bJQueryUI": true,  
    "sScrollY": "450px",
    "bPaginate": false, 
    "bScrollCollapse": true,
    "aoColumns": [null,null,null,{ "bVisible": false },null,null,{ "bVisible": false },null,null,null,null,null,null],
    "oLanguage": espanol
                })

    tablalistaproductos.columnFilter({"bUseColVis": true,"aoColumns": [null,null,null,{sSelector: "#numeros1", type:"number-range" },null,null,{sSelector: "#numeros", type:"number-range" },null,null,null,{ sSelector: "#mostrarproductofamilia", type:"select" },{ sSelector: "#mostrarproductoproveedor", type:"select" },null]});

感谢