Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
igGrid custom validator
posted

Hi – I am using Ignite UI with anguar 2 and typescript. I need my custom validator to do the following:

-          The validator fires with the user moves away from the cell after typing a new value

-          The new cell value is passed on to the custom validator

-          I need to know the column and the row for the cell that has changed

-          Validation: for the same row, check the new value typed by the user is equal or greater than the value in the same row but the previous column to the one firing the validator

 

This is what I have so far, but I do not know how to get hold of the row, column.

 

gridData.columnDefs.filter(cd => cd.key !== 'blah')

            .map(cd => {

                let cs = {

                    columnKey: cd.key,

                    editorType: 'numeric',

                    validation: true,

                    editorOptions: {

                        type: 'numeric',

                        // Must set max decimals so they're not rounded up to 0

                        maxDecimals: 5,

                        allowNullValue: true,

                        revertIfNotValid: false,

                        validatorOptions: {

                            // Value can be left null

                            required: false,

                            onblur: true,

                            onsubmit: true,

                            onchange: false,

                            valueRange: {

                                min: 0,

                                errorMessage: 'Value cannot be negative'

                            },

                            custom: function (value, fieldOptions) {

                                // How do I get hold of the row and column for the changed cell?

 

 

I have tried  jQuery('#' + gridId).igGrid('activeRow'); but it doesn’t work

 

Thanks