【发布时间】:2014-05-21 02:30:38
【问题描述】:
我正在使用强大的 jQuery 插件 dataTable,我需要: 1.从ajax源获取数据 2. 添加选择过滤输出
这是 HTML 代码:
<table id='probecardlist' class='display' cellspacing='0' width='100%'>
<thead>
<tr>
<th>Selection</th>
<th>Id</th>
<th>Production Area</th>
<th>Format</th>
<th>Orientation</th>
<th>Parallelism</th>
</tr>
</thead><thead>
<tr>
<th></th>
<th></th>
<th><select id='filter.productionarea'></select></th>
<th><select id='filter.format'></select></th>
<th><select id='filter.orientation'></select></th>
<th></th>
</tr>
</thead>
</table>
这就是 JS:
$( document ).ready(function() {
var table = $( '#probecardlist' ).dataTable({
'ajax' : 'http://whaelse.url/query.php',
'paging' : false,
'searching' : false,
'ordering' : true,
'columns' : [
{ 'data' : 'selection' },
{ 'data' : 'id' },
{ 'data' : 'productionarea' },
{ 'data' : 'format' },
{ 'data' : 'orientation' },
{ 'data' : 'dicecount' }
],
'fnInitComplete' : function( oSettings , json ) {
console.log( this.column( 'format:name' ).data() );
})
})
});
当我尝试仅列出(在控制台上)“格式”列的值列表时,我收到这样的错误:
Object #HTMLTableElement 没有方法'column'。
嗯……怎么了?
【问题讨论】:
标签: javascript jquery ajax datatables