2013-08-31 114 views
1

我使用colvis,多搜索在一起,但它也有一些問題,但..意外的結果一起

案例:
1.如果我取消「渲染引擎」,並使用多 - 搜索引擎版本(例如數據數據6或7),它不會提供任何數據。
2.多用於檢索算法CSS等級,它不會在搜索所有

我創建了這裏的jsfiddle http://jsfiddle.net/cyVjh/

腳本中使用

//Search 
$("tfoot input").keyup(function() { 
    /* Filter on the column (the index) of this element */ 
    oTable.fnFilter(this.value, $("tfoot input").index(this)); 
}); 

/* 
* Support functions to provide a little bit of 'user friendlyness' to the textboxes in 
* the footer 
*/ 
$("tfoot input").each(function (i) { 
    asInitVals[i] = this.value; 
}); 

$("tfoot input").focus(function() { 
    if (this.className == "search_init") { 
     this.className = ""; 
     this.value = ""; 
    } 
}); 

$("tfoot input").blur(function (i) { 
    if (this.value == "") { 
     this.className = "search_init"; 
     this.value = asInitVals[$("tfoot input").index(this)]; 
    } 
}); 

回答

1

我也面臨同樣的問題,並發現一個解決方案相同。

我們需要手動通過id列在搜索文本框中鑑於(HTML)文件

像EG。

<table cellpadding="0" cellspacing="0" border="0" id="listingentries"> 
    <thead> 
    <tr> 
     <td>column1<td> 
     <td>column2<td> 
     <td>column3<td> 
    </tr> 
    </thead> 

    <tbody> 
    <tr> 
     <td>val1<td> 
     <td>val2<td> 
     <td>val3<td> 
    </tr> 
    . 
    . 
    . 
    </tbody> 

    <tfoot> 
    <tr> 

     <!-- HERE I HAVE ADDED ID TO TEXT BOXES WHICH SHOWS COLUMNS SEQUENCE --> 

     <td><input id='0' type='text' title='Search column 1' /><td> 
     <td><input id='1' type='text' title='Search column 2' /><td> 
     <td><input id='2' type='text' title='Search column 3' /><td> 
    </tr> 
    </tfoot> 
</table> 

現在,我們需要在JS腳本來改變這樣的:

//Search 
$("tfoot input").keyup(function() { 
    /* Filter on the column (the index) of this element */ 

    //COMMENT THIS LINE 
    //oTable.fnFilter(this.value, $("tfoot input").index(this)); 

    //USE THIS - HERE WE WILL PASS ID WHICH IDENTIFY COLUMN INDEX 
    oTable.fnFilter(this.value, this.id); 

}); 

這工作了我的身邊。

這將適用於正常的Javascript搜索,也適用於服務器端搜索。

希望這也適合你。

謝謝。