如何在dojox.grid._Builder中覆盖doResizeColumn。我不知道如何处理它,因为它是变量dg._HeaderBuilder中的一个方法。任何帮助赞赏。
答案 0 :(得分:0)
如果您要为所有实例覆盖它,可以使用dojo/aspect
的{{1}}(请参阅Refernece Guide获取更多信息)来完成此操作,如下所示:
around()
修改强>
对于道场 define(["dojo/aspect"], function(aspect) {
aspect.around(dojox.grid._builder, "doResizeColumn", function(originalDoResizeColumn) {
return function(/* needs the original signature(params) of the original doResizeColumn */) {
// Your code here
/* you could call the original doResizeColumn (which you 'kinda override' here) anytime if you want just here
* originalDoResizeColumn(...);
*/
// and even do sth. after it.
};
});
});
来说,这有点实验性,但你可以尝试一下:
V1.6
查看this interesting blog entry或 dojo.require("dojox.lang.aspect");
var aop = dojox.lang.aspect; //define the namespace...
aop.advise(dojox.grid._Builder, 'doResizeColumn', {
around: function( /*originalparameters*/ ) {
// your code here
// the original coll looks as sth. like the following i dunno exactly
aop.proceed( /*fitting params*/ );
// some other code after it maybe...
}
});
dojox.lang.aspect
了解更多信息。也许dojox.lang.aspect.advise
的{{1}}可以更好地满足您的需求。请参阅上面的链接。
希望这会有所帮助。