How to access a cell value of grid column

I want to check Contract_End_Date should be greater than Contract_Start_Date at least

by six months. How can I achieve that?

allowPaging: true,

                    pageSettings: { pageSize: 10, printMode: ej.Grid.PrintMode.CurrentPage },

                    columns: [

                        { field: "Contract_Start_Date", headerText: 'Start Date', editType: "datepicker", format: "{0:MM/dd/yyyy}", validationRules: { required: true } },

                        //{ field: "Contract_End_Date", headerText: 'End Date', editType: "datepicker", format: "{0:MM/dd/yyyy}", validationRules: { required: true, min: [new Date("09/09/2022").toLocaleDateString(),"invalid End Date"] } },

                        { field: "Contract_End_Date", headerText: 'End Date', editType: "datepicker", format: "{0:MM/dd/yyyy}", validationRules: { required: true, min:"9/9/2022" } },



},

                    ],


1 Reply

RR Rajapandi Ravi Syncfusion Team September 30, 2022 12:56 PM UTC

Hi Abdu,


Greetings from Syncfusion support


From your query we could see that you like to access the cell value in the Grid, the queryCellInfo event triggers for every cell. In that event handler, you can get QueryCellInfoEventArgs that contains the details of the cell. Please refer the below documentation for more information.


Documentation: https://ej2.syncfusion.com/documentation/grid/cell/cell/#cell-customization


If you like to compare another cell value at the time of editing and having any condition to save the record, you can achieve your requirement by using custom validation feature of Grid. Please refer the below documentation for more information.


Documentation: https://ej2.syncfusion.com/documentation/grid/editing/validation/#custom-validation


Regards,

Rajapandi R


Loader.
Up arrow icon