“ e.handler.apply”在jQuery表排序器中不是函数 [英] "e.handler.apply" is not a function in jquery table sorter
问题描述
在我的一个应用程序中,我正在使用JQUERY tablesorter。但是在对任何Cloumns进行排序时,我都遇到了错误。知道为什么会这样。
In one of my application I am using JQUERY tablesorter.But while sorting with any of the cloumns I am getting below error. Any idea why this is happening.
错误: e.handler.apply在Jquery.js中不起作用
Error : "e.handler.apply" is not function in Jquery.js
$(".tablesorter")
.tablesorter(
{
headers: { 0: { sorter: false}},
widgets: ['zebra'],
fixedHeight: false
})
.tablesorterPager({
container: $(".pager")
});
$("#sortHeader").click(
$(".tablesorter")
.bind("sortStart",function(e, table)
{
$('.tablesorter').trigger('pageSet',0);
})
);
但是如果我注释从 $(#sortHeader)。click开始的代码,那就很好了。但是我需要这部分代码来满足我的要求。
But If I am commenting the code which starts from "$("#sortHeader").click" then it is working fine. But I need that portion of code to meet my requirement.
对此有任何想法。
推荐答案
您缺少 click()
的 function()
回调块:
$("#sortHeader").click(function(){ // <-----you need to have a callback function.
$(".tablesorter").bind("sortStart",function(e, table){
$('.tablesorter').trigger('pageSet',0);
});
}); // <---do a proper closing.
代码中的问题:
执行操作时:
Issue in your code:
When you do :
$("#sortHeader").click(
没有回调函数,因为您总是了解 错误: e.handler.apply在Jquery.js中不起作用
without a callback function that will always gives you error in the jQuery library as you got to know Error : "e.handler.apply" is not function in Jquery.js
因为编写 .click()
方法时,每次触发该事件时都需要一个回调函数来执行某些操作,因此jQuery认为(...这里...)
是触发的 click
事件的回调,并且无法应用该回调。
Because the way .click()
method is written it needs a callback function to do something whenever you fire this event. so in your code jQuery thinks that whatever written in the (...here...)
is a callback to the fired click
event and it fails to apply that callback.
这篇关于“ e.handler.apply”在jQuery表排序器中不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!