|
jr_subtable_init(string dialogElementName, object subtableData, function successCallback, function errorCallback) |
Scroll Prev Top Next More |
This function reloads the complete subtable view and fills it with data. It is used to enter multiple rows at once without the need to create the rows one by one. The existing data in the subtable view will be deleted.
Please note: When filling rows again, the column data is retained as long as it is not passed to the function. To replace a row completely, all columns must be filled with values.
Parameter |
Type |
Description |
|---|---|---|
dialogElementName |
string |
Name of the subtable in the form (Not: Name of the subtable view!) |
subtableData |
object |
JavaScript object with the values of the individual rows (structure see below) |
successCallback |
function |
Optional: Specifies a callback function (see examples) to be executed in case of success. The subtable view name is passed to it as parameter. |
errorCallback |
function |
Optional: Specifies a callback function that is executed in case of an error (see examples). The subtable view name is passed to it as parameter. |
Please note: The callback functions BeforeRemove and AfterRemove are called during the execution of jr_subtable_init when removing existing lines. For lines added to jr_subtable_init, the BeforeAdd and AfterAdd callback functions are not called.
The parameter subtableData includes all values of all rows that are to be filled. The schematic structure of the object:
{
rowNr1: {
stvColNameA: wertA,
stvColNameB: wertB,
…,
stvColNameN: wertN
},
…,
rowNrN: {
stvColNameA: wertA,
stvColNameB: wertB,
…,
stvColNameN: wertN
}
}
rowNr1 … rowNrN are the row numbers, counting starts at 1. The values (valueA, …, valueN) in the respective row hashes have to be enclosed by single or double quotes according to the JavaScript syntax rules, if they are Strings etc.
Example:
function mySuccessCallback(subtableViewName) {
alert('Initialization of subtableview ' + subtableViewName + ' was successfull.');
}
function myErrorCallback(subtableViewName, errorMessage) {
alert('Error during initialization of subtable view ' + subtableViewName);
}
jr_subtable_init('invoices', {
1: {
invoicenumber: 837452,
company: 'Max Mustermann AG'
},
2: {
invoicenumber: 294752,
company: 'Acme Ltd.'
}
}, mySuccessCallback, myErrorCallback);
The resulting subtable view includes the follwing data:
invoice number |
company |
|---|---|
837452 |
Max Mustermann AG |
294752 |
Acme Ltd. |
Repeated call with overwriting data:
{
1: {
invoice number: 837455,
},
2: {
invoice number: 294755,
company: 'Acme Ltd.'
}
}
Result:
invoice number |
company |
837455 |
Max Mustermann AG |
294755 |
Acme Systems |