It would be great to be able to extend or override the internal services of revogrid. It's currently possible to hook into the events and customise the grid for our needs, but for some changes it would be great to change the default behaviour.
For example:
Change the autofill behaviour to automatically increment the value instead of just copying the value.
Currently we can hook into the beforeautofill event and add some custom logic, but it's quite complex.
onBeforeAutoFill($event: Event) {
const detail: { colType: "rgCol", type: "rgRow", newData: { [key: number]: { [key: string]: unknown } }, oldRange: { x: number, y: number, x1: number, y1: number }, newRange: { x: number, y: number, x1: number, y1: number }, mapping: { [key: number]: { [key: string]: { colProp: string, rowIndex: number, colIndex: number } } } } = ($event as any).detail;
// only single column supported
if (detail.oldRange.x != detail.oldRange.x1 || detail.oldRange.y != detail.oldRange.y1 || detail.newRange.x != detail.newRange.x1) {
$event.preventDefault();
return;
}
let i = 0;
for (const idx in detail.mapping) {
const newData = detail.newData[idx];
const keys = Object.keys(newData);
if (keys.length != 1) {
$event.preventDefault();
return;
}
const key = keys[0];
const mapping = detail.mapping[idx];
const myMapping = mapping[key];
if (key == "number") {
const value = newData[key];
const newValue = value + index + 1
newData[key] = newValue
}
i++;
}
}
It would be great to be able to extend or override the internal services of revogrid. It's currently possible to hook into the events and customise the grid for our needs, but for some changes it would be great to change the default behaviour.
For example:
Change the autofill behaviour to automatically increment the value instead of just copying the value.
Currently we can hook into the beforeautofill event and add some custom logic, but it's quite complex.