【发布时间】:2014-11-19 04:14:02
【问题描述】:
我正在尝试做一个任务,就像这个question一样。
- 我有一个工作的 jquery 数据表
- 我想要一个函数来重置排序,这是在用户选择任何列之前,与从 HTML 中读取相同。
它引导我找到了一个不错的插件。
http://datatables.net/plug-ins/api/fnSortNeutral
jQuery.fn.dataTableExt.oApi.fnSortNeutral = function ( oSettings )
{
/* Remove any current sorting */
oSettings.aaSorting = [];
/* Sort display arrays so we get them in numerical order */
oSettings.aiDisplay.sort( function (x,y) {
return x-y;
} );
oSettings.aiDisplayMaster.sort( function (x,y) {
return x-y;
} );
/* Redraw */
oSettings.oApi._fnReDraw( oSettings );
};
但是我不知道“如何使它工作”。任何人都知道什么是“oApi”,或者在我使用这个插件之前我需要更多的设置吗?
因为我的脚本在我复制脚本后立即显示Uncaught TypeError: Cannot read property 'oApi' of undefined ,并且错误使函数未定义。我该怎么办?
【问题讨论】: