如何基于 widgetVar 在 Primefaces 组件中查找和/或覆盖 JavaScript? [英] How do I find and/or override JavaScript in Primefaces component based on widgetVar?
问题描述
根据这个问题:多文件上传与额外的 inputText 我可以以这种方式使用 widgetVar 覆盖 PrimeFaces 元素的 JavaScript 函数:
According to this question: Multiple file upload with extra inputText I can override JavaScript function of PrimeFaces element by using widgetVar in this way:
PF('fileUpload').jq.fileupload({
add: function(e, data) {
...
}
});
现在,我尝试覆盖 DataTable 中的函数,但无法理解如何引用它?此外,PF(') 从 chrome 调试器控制台返回 undefined,所以我无法调试它.我怀疑这是范围的问题,但不知道如何解决.
Now, I try to override function in DataTable and can't understand how do I reference to it? Moreover, PF(') returns undefined from chrome debugger console, so I can't debug it. I suspect that it's matter of scopes but don't know how to solve it.
推荐答案
你可以使用原型,例如覆盖 bindEditEvents
看起来像这样
You could use the prototype,
for example overriding bindEditEvents
would look like this
PrimeFaces.widget.DataTable.prototype.bindEditEvents = function() {
....
}
这篇关于如何基于 widgetVar 在 Primefaces 组件中查找和/或覆盖 JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!