0

我正在使用数据表插件,当您扫描意图时我遇到了问题。如本页所述,按列进行的搜索:

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 }} €&lt;/td>
            <td>{{ entity.pcompra }} €&lt;/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>
4

1 回答 1

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]});

谢谢

于 2012-11-02T11:34:15.427 回答