How can i sort the grid columns by validation error

Posted by: lost7l on 28 June 2023, 1:08 pm EST

  • Posted 28 June 2023, 1:08 pm EST

    hello, thank you for your help.

    I want to sort my grid column by validation result.

    Especially in wijmo with react js.

    In official demo page for CollectionView Validation, the page represents a grid with validation.

    (https://www.grapecity.com/wijmo/demos/Core/CollectionView/EditingViews/Validation/react)

    The thing is, when i click the left top square where row header and column header meet, the whole grid is selecting. I think the default option of the square is select all. But, I want to revise that from select all to sort by validation error y n.

    If the default work of select all can’t be changed, I want to make a button to sort the very left column(maybe row header) at least.

    Thank you!

  • Posted 29 June 2023, 9:29 pm EST

    Hi,

    For this, you may need to define your own sortComaprere. Please refer to the following code snippet and the attached sample.

    
       this._view = new wijmo.CollectionView(getData(), {
                getError: this._getError.bind(this),
                sortComparer: (a, b) => {
                    let aa = 0,bb =0;
                     aa  += this._getError(a, a.currentProp) ? 1 :0;
                     bb  += this._getError(b, b.currentProp) ? 1: 0 
                    return aa- bb;
                },
                sortConverter: (sd, item, value) => {
                    // attache the propety name so that we can access it in sortComparer
                    item.currentProp = sd.property;
                    return item
                }
            });

    sample: https://jscodemine.grapecity.com/share/JdE_tP-DyEmAQrqo3fOvQg/?defaultOpen={"OpenedFileName"%3A["%2Findex.html"%2C"%2Fsrc%2Fapp.jsx"]%2C"ActiveFile"%3A"%2Fsrc%2Fapp.jsx"}

    regards,

    Avinash

Need extra support?

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

Learn More

Forum Channels