How to reset the paging subdataset to avoid error on a master/detail grid ?
- September 20, 2021
- 9 replies
- 0 views
Hi,
I'm using a master/detail pattern with 2 grids, and I can observe an error when on the detail Grid I click Next paging (ex: set to "5-8 of 10") before to click on another row of the master grid.
ERROR : "Interface Definition: Expression evaluation error at function a!gridField [line 74]: A grid component [label=""] has an invalid value for "value" and "totalCount". "startIndex" must not be greater than "totalCount", but "startIndex" was 5 and "totalCount" was 1."
After browsing the forum I've read that I need to reset the paginginfo because the datasubset keeps the previous values.
Could you tell what to add or change in my code example to make it working please ?
{
a!localVariables(
local!pagingCustomers: a!pagingInfo(
startIndex: 1,
batchSize: 4
),
local!customers: rule!CJT2_GetCustomersWithFilters(
id: null,
pagingInfo: local!pagingCustomers
),
local!selectedCustomer: null,
local!pagingContacts: a!pagingInfo(
startIndex: 1,
batchSize: 4
),
local!contacts: rule!CJT2_GetContactsWithFilters(
customerId: local!selectedCustomer.id,
pagingInfo: local!pagingContacts
),
{
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
a!sectionLayout(
label: "Customers",
contents: {
a!gridField(
data: local!customers,
pagingSaveInto: local!pagingCustomers,
columns: {
a!gridColumn(
label: "Id",
value: fv!row.id
),
a!gridColumn(
label: "Name",
value: fv!row.name
),
a!gridColumn(
label: "Test",
value: fv!row.test
)
},
/*pageSize: 7,*/
selectable: true,
selectionStyle: "ROW_HIGHLIGHT",
selectionValue: index(local!selectedCustomer, "id", {}),
selectionSaveInto: {
/* This save replaces the value of the previously selected item with that of the newly selected item, ensuring only one item can be selected at once.*/
a!save(
local!selectedCustomer,
if(
length(fv!selectedRows) > 0,
fv!selectedRows[length(fv!selectedRows)],
null
)
)
},
shadeAlternateRows: false,
rowHeader: 1
),
a!sectionLayout(
label: "Contacts",
contents: {
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
a!gridField(
data: local!contacts,
pagingSaveInto: local!pagingContacts,
columns: {
a!gridColumn(
label: "Id",
value: fv!row.id
),
a!gridColumn(
label: "Name",
value: fv!row.name
),
a!gridColumn(
label: "Customer Id",
value: fv!row.fk_customer_id
)
},
/*pageSize: 7,*/
selectable: true,
selectionStyle: "ROW_HIGHLIGHT",
selectionValue: index(local!selectedCustomer, "id", {}),
selectionSaveInto: {
/* This save replaces the value of the previously selected item with that of the newly selected item, ensuring only one item can be selected at once.*/
a!save(
local!selectedCustomer,
if(
length(fv!selectedRows) > 0,
fv!selectedRows[length(fv!selectedRows)],
null
)
)
},
shadeAlternateRows: false,
rowHeader: 1
),
}
),
},
showWhen: true
)
}
)
}
)
}
),
}
)
}
)
}
