$.extend($.fn.datagrid.defaults.editors, { numberbox: { init: function (container, options) { var input = $('<input type="text">').appendTo(container); if (options && options.ratio) { input.data("ratio", options.ratio); } return input.numberbox(options);; }, destroy: function (target) { $(target).numberbox('destroy'); }, getValue: function (target) { var value = $(target).numberbox('getValue'); var ratio = $(target).data("ratio"); if (ratio) { value = value*ratio; } return value; }, setValue: function (target, value) { var ratio = $(target).data("ratio"); if (ratio) { value = value / ratio; } return $(target).numberbox('setValue',value); }, resize: function (target, width) { $(target).numberbox("resize", width); } } });