Hi
I am using the Unified Interface. I can't seem to get the grid count to work anymore.
function getGridRowCount(formContext, gridControl) { var subGrid = formContext.getControl(gridControl).getGrid(); var subGridRows = subGrid.getRows().getLength(); return subGridRows; }
There are multiple things here,
As Ravi Kashyap explained, the proper method is the getTotalRecordCount.
So this should work:
var formContext = executionContext.getFormContext(); // get the form Context
var gridContext = formContext.getControl("contacts"); // get the contacts subgrid context
var filteredRecordCount = gridContext.getGrid().getTotalRecordCount();
Now as Ics_rthompsoneu suggested, subgrids and web resources within tabs are not loaded until the tab is displayed.
This is by design to optimize performances. Have you referred to that article?
Use collapsed tabs to defer loading web resources
When web resources or IFRAMES are included in sections inside a collapsed tab they will not be loaded if the tab is collapsed. They will be loaded when the tab is expanded. When the tab state changes theTabStateChange
event occurs. Any code that is required to support web resources or IFRAMEs within collapsed tabs can use event handlers for the TabStateChange event and reduce code that might otherwise have to occur in theOnLoad
event.
Henry
we have the same issue. the length always return 0 in UCI.
We try to get the attribute from each row. But the forEach never executed.
var rows = formContext.getControl(xxx_SUBGRID).getGrid().getRows();
rows.forEach(function (row, i) {
var text = row.data.entity.getPrimaryAttributeValue();
});
Please help to fix the issue!
Thanks!
I changed my code still not working.
I am wondering if the problem has to do with the sections appearing as "Tabs" in UI.
export function getGridRowCount(formContext, gridControl) { var gridContext = formContext.getControl(gridControl); var totalSubGridRows = (gridContext).getGrid().getTotalRecordCount(); return totalSubGridRows; }
Hi,
Try using getTotalRecordCount
method instead of length.
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156