Is there a clever method to pass an angular object function call to the same function on an internal object?
This is my current setup:
var grid = $('#' + config.selector).w2grid(gridConfig);
angular.merge(this, {
addData: addData,
lock: lock,
unlock: unlock,
reload: reload,
clear: clear,
removeRow: removeRow,
getRecord: getRecord,
setRecord: setRecord,
refreshRow: refreshRow,
destroy: destroy,
resize: resize,
setData: setData,
selectNone: selectNone,
getSelection: getSelection
});
....
function addData(data) {
grid.add(data);
}
function lock(message) {
grid.lock(message || '', true);
}
function unlock() {
grid.unlock();
}
function reload() {
grid.reload();
}
function clear() {
grid.clear();
}
I want to only keep overridden grid functions
var grid = $('#' + config.selector).w2grid(gridConfig);
....
function addData(data) {
alert('add data override');
}
....
So when angularObject.reload()
function is called, it should trigger grid.reload()
, and if angularObject.addData()
is invoked, it will call the overridden addData()
function within the angular object.