Zum Hauptinhalt springen

TableMonitor

Beispiel

Beispielcode

context.enableModules();
const { TableMonitor } = require("ou.sp.gadget.TableMonitor");

const gadget = new TableMonitor({
id: "table-monitor",
allowEdit: true,
select: true,
multiSelect: true,
allowDelete: true,
showOptions: true,
showFooter: false,
fieldName: "test",
buttons: {
add: {
label: "Neue Zeile",
tooltip: "Neue Zeile hinzufügen",
click: (options) => {
options.addRow(
{
status: "offen",
},
0
);
options.focusInputInRow(0, 0);
},
},
remove: {
label: "Zeilen löschen",
tooltip: "Markierte Zeilen löschen",
click: (options) => {
options.removeSelectedRows();
},
enabled: (selectedRows) => selectedRows.length > 0,
},
moveUp: {
label: "Zeile nach oben",
tooltip: "Markierte Zeile nach oben verschieben",
toggleGroup: "move",
enabled: "single",
click: (options) => {
if (options.selectedRows.length !== 1) {
return;
}
const index = options.rows.findIndex((row) => row === options.selectedRows[0]);
if (index === 0) {
return;
}
options.moveSelectedRow(index - 1);
},
},
moveDown: {
label: "Zeile nach unten",
tooltip: "Markierte Zeile nach unten verschieben",
toggleGroup: "move",
enabled: "single",
click: (options) => {
if (options.selectedRows.length !== 1) {
return;
}
const index = options.rows.findIndex((row) => row === options.selectedRows[0]);
if (index === options.rows.length - 1) {
return;
}
options.moveSelectedRow(index + 1);
},
},
},
columns: {
id: { label: "de:Kreditorennummer;en:vendor no." },
vendorName: "de:Kreditor;en:vendor",
recipient: "de:RK;en:recipient",
barcode: "de:Barcode;en:barcode",
amount: {
label: "de:Netto;en:netto",
type: "currency",
},
totalAmount: {
label: "de:Brutto;en:brutto",
type: "currency",
},
status: {
label: "de:Status;en:state",
type: "badge",
badges: {
Erledigt: "success",
offen: "error",
},
},
},
rows: [
{
id: "123456",
vendorName: "One Unity",
recipient: "OUC",
barcode: "1234567",
amount: 42.0,
totalAmount: 49.98,
status: "Erledigt",
},
{
id: "123456",
vendorName: "One Unity",
recipient: "OUC",
barcode: "1234567",
amount: 50.0,
totalAmount: 59.5,
status: "offen",
},
{
id: "123456",
vendorName: "One Unity",
recipient: "OUC",
barcode: "1234567",
amount: 1200.3,
totalAmount: 1428.36,
status: "offen",
},
],
});
context.returnValue = gadget.transfer();

Einrichtung

Die Einrichtung wird über die Eigenschaft monitorGadgetConfig geregelt.

Im Mappentyp unter Eigenschaften folgende Eigenschaft hinzufügen:

Name: monitorGadgetConfig
Wert: { gadgetScript: 'Gadget_ou.cust.demo.multiTable.gentable', gadgetAction: 'build' }

Einstellungen