getFirstErrorButton();
The getFirstErrorButton method returns the First Error button on the Validation tab of workbook ribbon.
This method returns an object of the PP.Ui.RibbonButton type.
On clicking this button the cell corresponding to the first validation error is selected in workbook table.
To execute the example, the HTML page must contain the WorkbookBox component named workbookBox (see Example of Creating the WorkbookBox Component), and a table must be loaded to workbook data area. A validation rule that finds at least two invalid values must be executed.
Get coordinates of table cells that correspond to the first and the next validation errors:
// Get workbook tool ribbon var ribbon = workbookBox.getRibbonView(); // Get the Validation tab var validationCategory = ribbon.getValidationCategory(); // Display and open the tab validationCategory.setIsHiddenActive(True) ribbon.refreshAll(); // Get workbook table var tabSheet = workbookBox.getDataView().getGridView().getTabSheet(); // Process table selection change event tabSheet.SelectionChanged.add(function () { // Get coordinates and value of the selected cell var coord = tabSheet.getSelectedCoord(); console.log("Cell with the coordinates (" + coord.rowIndex + ", " + coord.colIndex + ") is selected") }); // Get the Next Error button var nextErrorButton = validationCategory.getNextErrorButton(); // Fire the button click event nextErrorButton.Click.fire(nextErrorButton); // Get the First Error button var firstErrorButton = validationCategory.getFirstErrorButton(); // Fire the button click event firstErrorButton.Click.fire(firstErrorButton);
After executing the example coordinates of the first and the next validation errors are shown in the browser console:
The cell under coordinates (2, 8) is selected
The cell under coordinates (1, 28) is selected
See also: