isAllLoaded();
The isAllLoaded method determines whether all elements of the list are loaded.
The method returns True if all elements are loaded, otherwise it returns False.
Executing the example requires the LongListBox component with the longListBox name (see Example of Creating the LongListBox Component). Add a group and check whether all elements of the list are loaded:
// Add one more group longListBox.beginUpdate(); longListBox.addGroups({ Items: [{}, {}, {}] }); longListBox.endUpdate(); // Check whether all elements of the list are loaded if (longListBox.isAllLoaded) { console.log("All elements are loaded"); } else { console.log("Not all elements are loaded"); }
As a result the console displays the result of a check:
Not all elements are loaded
Scroll the list to the end and check once again whether all elements are loaded:
// Scroll the list to the lower border longListBox.getScrollBar().scrollTo(100, True);
As a result the list will be scrolled to the end:
The console will display check result:
All elements are loaded
Check whether the last visible element is the last one among all elements.
// Obtain last visible element var arr = longListBox.getVisibleItems(); var lastVisibleItem = arr[arr.length - 1]; // Set new template to the last element lastVisibleItem.setTemplate("New template"); // Check whether the last visible element is the last of all elements arr = longListBox.getItems(True); var lastItem = arr[arr.length - 1]; if (lastVisibleItem.getId() == lastItem.getId()) { console.log("Last visible element is the last in the list"); } else { console.log("Last visible element is not the last in the list"); }
As a result the console displays the result of check of the last element:
The last visible element is the last in the list
The value of the last element will be changed to the new one:
See also: