How to count total all cells invalid in FlexGird wijmo

Posted by: viethdhe130200 on 26 November 2021, 4:04 am EST

  • Posted 26 November 2021, 4:04 am EST - Updated 3 October 2022, 12:14 pm EST

    My table has scroll horizontal and I use validate like this (https://www.grapecity.com/wijmo/demos/Grid/Overview/react). My problem that I want to display text show total cells invalid in table.

    Example: Has 5 invalids cell in table

    So, somebody help me count total cells invalid in table wijmo. Thank you.

  • Posted 29 November 2021, 8:12 am EST

    Hello,

    You may use the getError method of CollectionView to get the information on the number of invalid cells. The getError method returns true for the invalid cells and null if no errors were detected, check for the invalid cells after the grid rows get loaded .i.e. handling loadedRows event of FlexGrid. Please refer to the code snippet and sample link below demonstrating the same:

    
            this.loadedRowsGrid = (ctl, e) => {
                this.state.errorCount = 0
                ctl.collectionView.items.forEach((item, index) => {
                    ctl.columns.forEach((col) => {
                        if (ctl.collectionView.getError(item, col.binding)) {
                            this.state.errorCount++
                        }
                    })
                })
            }
    
    

    Sample link: https://jscodemine.grapecity.com/share/ioMnlbLb2kqQjNzMnDWWsg/

    Regards

  • Posted 30 November 2021, 5:12 am EST

    Thank you for your answer, sonu pandey. I did it.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels