How to overload a JavaScript function? (changing Slickgrid's editor) -
i'm using slickgrid , change behavior of editor. instead of copy&paste tried overload 1 of functions doesn't work. cannot read loadvalue function.
loadvalue defined (some code omitted)
integercelleditor : function(args) { this.loadvalue = function(item) { defaultvalue = item[args.column.field]; $input.val(defaultvalue); $input[0].defaultvalue = defaultvalue; $input.select(); }; }
what tried is:
function tristateintegercelleditor(check_field) { var f = integercelleditor; var f_loadvalue = f.loadvalue; f.loadvalue = function(item) { f_loadvalue(item); if (check_field) { if (!item[check_field]) { $select.disable(); } } }; return f; }
is there way substitute function?
you need f_loadvalue.call(this, item);
otherwise old loadvalue
get's called it's context (this
) window
(the default).
related:
Comments
Post a Comment