2012-05-28 126 views
2

我正在使用外部窗體使用自定義過濾器,如this link。但是,即使我嘗試向index.html頁面添加類似的代碼,我也無法創建自定義過濾器字段。將自定義過濾器字段添加到jQuery Datatable

這裏是我的附加過濾柱:

<div id="renderingEngineFilter" class="filterOption"></div> 
<div id="browserFilter" class="filterOption"></div> 
<div id="platformsFilter" class="filterOption"></div> 
<div id="engineVersionFilter" class="filterOption range"></div> 
<div id="cssGradeFilter" class="filterOption"></div> 
<div id="customFilter"></div> <!-- this one --> 

,我把它添加到我的jQuery的功能是這樣的:

$(document).ready(function() { 
    $('#example').dataTable({ 
     "bJQueryUI": true, 
     "sPaginationType": "full_numbers" 
    }) 
    .columnFilter({ 
     aoColumns: [ 
      { type:"select", sSelector: "#renderingEngineFilter" }, 
      { sSelector: "#browserFilter" }, 
      { sSelector: "#platformsFilter" }, 
      { type:"number-range", sSelector: "#engineVersionFilter" }, 
      { type:"select", values : ["A", "B", "C", "X"], sSelector: "#cssGradeFilter" }, 
      { type:"select", values : ["vannkorn", "ravy", "rayuth"], sSelector: "#customFilter"} //here is where I add it 
     ] 
    }); 
}); 

不幸的是,它不顯示此自定義字段。請幫忙。

回答

1

這是因爲你的表格,我肯定只有5列,所以你不能在那裏應用第六個過濾器。如果仔細觀察,可以看到columnFilteraoColumns

相關問題