数据表未捕获类型错误
Datatables Uncaught Type Error
我有Datatables和GridRowCount()一起获取html表中指定组的行计数,jfiddle站点在这里。当我运行代码时,chrome 浏览器会抛出一个未捕获的类型错误 (...Live 不是一个函数。
将显示来自控制台的错误。
rowtoggle.js:30 Uncaught TypeError: $(...).live is not a function
rowtoggle.js:30 Uncaught TypeError: $(...).live is not a functionGridRowCount @ rowtoggle.js:30(anonymous function) @ rowtoggle.js:16i @ jquery-1.12.2.min.js:2j.fireWith @ jquery-1.12.2.min.js:2n.extend.ready @ jquery-1.12.2.min.js:2K @ jquery-1.12.2.min.js:2
Navigated to http://localhost/datacentre/admin/request_pending.php
rowtoggle.js:30 Uncaught TypeError: $(...).live is not a functionGridRowCount @ rowtoggle.js:30(anonymous function) @ rowtoggle.js:16i @ jquery-1.12.2.min.js:2j.fireWith @ jquery-1.12.2.min.js:2n.extend.ready @ jquery-1.12.2.min.js:2K @ jquery-1.12.2.min.js:2
Navigated to http://localhost/datacentre/admin/request_pending.php
下面是数据表和 GroupRowCount() 插件的代码。
$( document ).ready(function() {
$('#example').dataTable({
"bLengthChange": false,
"bPaginate": false,
"bJQueryUI": true
}).rowGrouping({
iGroupingColumnIndex: 1,
sGroupingColumnSortDirection: "asc",
iGroupingOrderByColumnIndex: 0 ,
bExpandableGrouping: true,
bExpandSingleGroup: false,
iExpandGroupOffset: -1,
asExpandedGroups: [""]
});
GridRowCount();
});
function GridRowCount() {
$('span.rowCount-grid').remove();
$('input.expandedOrCollapsedGroup').remove();
$('.dataTables_wrapper').find('[id|=group-id]').each(function () {
var rowCount = $(this).nextUntil('[id|=group-id]').length;
$(this).find('td').append($('<span />', { 'class': 'rowCount-grid' }).append($('<b />', { 'text': rowCount })));
});
$('.dataTables_wrapper').find('.dataTables_filter').append($('<input />', { 'type': 'button', 'class': 'expandedOrCollapsedGroup collapsed', 'value': 'Expanded All Group' }));
**$('.expandedOrCollapsedGroup').live('click', function () {
if ($(this).hasClass('collapsed')) {**
$(this).addClass('expanded').removeClass('collapsed').val('Collapse All Group').parents('.dataTables_wrapper').find('.collapsed-group').trigger('click');
}
else {
$(this).addClass('collapsed').removeClass('expanded').val('Expanded All Group').parents('.dataTables_wrapper').find('.expanded-group').trigger('click');
}
});
};
.live()
在jQuery 1.7 中已被弃用,并在 1.9 版中删除。你应该使用 .on()
$('.expandedOrCollapsedGroup').on('click', function () {
//Your code
})
相关文章:
- 为什么会出现错误;未捕获的类型错误:undefined不是函数;
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- 未捕获的类型错误:无法读取属性'删除'的未定义
- 未捕获的类型错误:无法读取属性'name'即使它存在,也无法定义
- 看到“;未捕获的类型错误:无法读取属性'weight'未定义的“;尽管按照字面上的指示
- Soundcloud api"未捕获的类型错误:无法读取属性'uri'“未定义”;
- 未捕获的类型错误:无法读取属性'addEventListener'的null chrome扩展名
- 如何解决这种情况下的非法调用类型错误
- 未捕获的类型错误:$(..).dataTable不是函数
- 未捕获的类型错误:无法读取属性'状态'在react中为null
- 未捕获的类型错误:topFrame.window.changeSelectedBarStyle不是函数,原因是什么
- 类型错误:url未定义extjs 4正在填充组合框
- 未捕获的类型错误:无法读取属性'中止'的未定义
- 类型错误'未定义'不是对象(正在评估'navigator.connection.type'
- 未捕获的类型错误:无法设置属性'innerHTML'如果为null,则将脚本移动到正文不会;不起作用
- 未捕获的类型错误:undefined不是函数$
- 输入类型文件的未捕获类型错误
- 未捕获的类型错误:无法设置属性'背景'的未定义
- "未捕获类型错误/丢弃意外“;因为一句台词而出现?(HTML w/<脚本>)
- Javascript未捕获类型错误:无法读取属性'0'的未定义