Skip to content

Replies

0
Monika Kirkova
Monika Kirkova answered on Mar 5, 2026 4:53 PM

Hello,

This could be achieved by using minDate and maxDate options of the jQuery datepicker – they set the minimum/maximum selectable date. This could be achieved as follows:

editorOptions: {

      dateInputFormat: "yyyy-MM-dd/HH:mm:ss",

      valueFormat: "date",

      datepickerOptions: {

            changeMonth: true,

            changeYear: true,

            minDate: 0,

            maxDate: "+3m"

     },

. . .

}

Please test it on your side and let me know if you need any further information regarding this matter.

Regards,
Monika Kirkova,
Infragistics

0
Monika Kirkova
Monika Kirkova answered on Mar 4, 2026 10:39 PM

Hello,

Both the required validation and a custom validation can be used together. With the custom validation in place, the user will not be able to select a date earlier than today. However, if an existing record is updated and the date field is not modified, the record could still be saved even if the stored date is now outside the allowed range. The validation is triggered only when a new date is selected.

The custom validation could be applied as follows:

{

          name: "Updating",

          editMode: "row",

          editRowStarting: function (evt, ui) {

            oldDate = $("#grid").igGrid("getCellValue", ui.rowID, "Date")

          },

          columnSettings: [
          {
            columnKey: "Date",
            editorType: "datepicker",
            required: true,
            editorOptions: {
                dateInputFormat: "yyyy-MM-dd/HH:mm:ss",
                valueFormat: "date",
                datepickerOptions: {
                    changeMonth: true,
                    changeYear: true
                },
                validatorOptions: {
                    required: true,
                    notificationOptions: {
                        mode: "popover"
                    },
                    errorMessage: "error",
                    custom: {
                        method: function(value, fieldOptions){
                            let minRange = new Date();
                            let maxRange = new Date();
                            maxRange.setMonth(maxRange.getMonth() + 3);
                            if (value.getTime() === oldDate.getTime()) {
                                return true
                            } else if (value >= minRange && value <= maxRange) {
                                return true;
                            } else {
                                return false;
                            }
                        },
                        errorMessage : "Value did not match"
                    }
                }
            }
          }]
        }

Please test the provided sample on your side and let me know if you need any further information regarding this matter.

Regards,
Monika Kirkova,
Infragistics

0
Monika Kirkova
Monika Kirkova answered on Feb 27, 2026 3:15 PM

Hello,

I have noticed that there is another forum thread regarding the same query, where I have already provided an answer.

Please, keep in mind that according to our support policy we handle singe thread per issue. This helps us ensure that all issues are addressed and handled correctly.

Thank you for using Infragistics components.

Regards,
Monika Kirkova,
Infragistics

 

0
Monika Kirkova
Monika Kirkova answered on Feb 27, 2026 3:14 PM

Hello,

After an investigation, I have determined that your requirement could be achieved by displaying the validation message only when the date editor is focused and not when the row enters edit mode. This could be achieved by setting ‘OnBlur’ to false and ‘OnChange’ to true in the validator options.

cs.ColumnSetting().ColumnKey("Birthdate").EditorType(ColumnEditorType.DatePicker).DateEditorOptions(options =>
{
    options.ValidatorOptions(vo =>
    {
        vo.ValueRange(DateTime.Now, new DateTime(2026, 05, 29)).OnBlur(false).OnChange(true);
    });
});

However, if the user should be able to save the record if the date is not updated, even if it’s now outside the range, what I could suggest is using a custom validation method like this:

cs.ColumnSetting().ColumnKey("Birthdate").EditorType(ColumnEditorType.DatePicker).DateEditorOptions(options =>
{
    options.ValidatorOptions(vo =>
    {
        vo.Custom("validate", "Date should be in range");
    });
});
<script>
    let oldDate;
    function editRowStarting(evt, ui) {
        oldDate = $("#grid").igGrid("getCellValue", ui.rowID, "Birthdate")
    }
    function validate(value, fieldOptions) {
        let minRange = new Date();
        let maxRange = new Date();
        maxRange.setMonth(maxRange.getMonth() + 3);
        if (value.getTime() === oldDate.getTime()) {
            return true
        } else if (value >= minRange && value <= maxRange) {
            return true;
        } else {
            return false;
        }
    }
</script>

Please test this approach on your side and let me know if you need any further information regarding this matter.

Regards,
Monika Kirkova
Infragistics

0
Monika Kirkova
Monika Kirkova answered on Oct 11, 2024 2:30 PM

Hello,

I have added column groups to the sample, however, I am still not able to reproduce the described behavior. The scrollbar is preserved when navigating between the tabs.

Please test the modified sample on your side and let me know how it behaves. If the behavior cannot be replicated, please provide your own isolated sample, demonstrating the behavior. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach it in this case.

Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.

Thank you for your cooperation.

Looking forward to hearing from you.

Regards,
Monika Kirkova,
Infragistics

0
Monika Kirkova
Monika Kirkova answered on Oct 10, 2024 10:47 PM

Hello,

I have prepared a sample with the provided code, however, on my side the page of the grid and the position of the scrollbar persists when navigating between the tabs.

Please test the provided sample on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated, please feel free to provide your own isolated sample.

Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.

Thank you for your cooperation.

Looking forward to hearing from you.

Regards,
Monika Kirkova,
Infragistics

0
Monika Kirkova
Monika Kirkova answered on Sep 19, 2023 7:36 AM

Hello Adam,

I am glad my suggestion was helpful and you were able to achieve your requirement.

Thank you for using Infragistics components.

Regards,
Monika Kirkova,
Infragistics