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
25
Limit values of Datepicker entry when editing a row in igGrid
posted

Hi

I have an updatable date column in my iggrid, and I use a Datepicker to edit. I would like to limite the allowed values in the datepicker based in other values of the row. For instance if the value entered in the Datepicker could not be greater than the field Deliver Date.

Thanks

Parents
No Data
Reply
  • 17590
    Offline posted

    Hello Clovis,

    Thank you for posting in our community.

    What I can suggest for achieving your requirement is handling editCellStaring event of the Updating feature. In this event the value of the cell that you would like to use as a min date could be retrieved and could be set to the minValue option of the DatePicker editor. For example:

      $(document).delegate("#grid", "iggridupdatingeditcellstarting", function (evt, ui) {
                var colKey = ui.columnKey;
                var rowID = ui.rowID;
              
                if (colKey == "EndDate") {
                    var minValue = $("#grid").igGrid("getCellValue", rowID, "StartDate");
                    var endDateEditor = $("#grid").igGridUpdating("editorForKey", "EndDate");
                    $(endDateEditor).igEditor("option", "minValue", minValue);
                }
            });

    I am also attaching a small sample illustrating my suggestion for your reference. In my sample I have two date time columns - Start Date and End Date. The dates entered in the end date should not be prior to the start date.

    Please have a look at the attached sample and let me know whether this helps you achieve your requirement.

    igGridSetMinDatdValueBasedOnANotherCell.zip
Children