Datepicker start date and end date validation inside datatable

In this template, datepickers are used as an editor within the datatable hence I'm not able to get the Id of its editor. Validation on datepickers within the form is possible but not here.

  1. I have added the validation as start date to be smaller than the end date and ice versa but I want to clear the date selection of start date when user changes end date first or when he selects the prior date than the start date.
  2. I'm not able to find the ID of the editor within the datatable, because I have the column ID already mentioned.
  3. Also I want to perform the date reset or clear its selection manually on different function.
  4. Please check the snippet here https://snippet.webix.com/ea3oaghx

Comments

  • Hello,

    You can compare two editors in the row with the help of onAfterEditStop event. To update the date selection should use updateItem method.

      on:{
        onAfterEditStop:function(value, config){
          var value = value.value;
          var item = this.getItem(config.row);
          if(config.column == "start"){
            if(value > item.end){                          //start date bigger than end date
              item.end = "";
              this.updateItem(item.id, item);
            }
          } 
    
          if(config.column == "end"){
            if(value < item.start){                          //end date smaller than start date
              item.start = "";
              this.updateItem(item.id, item);
            }
          }
        }
      },
    

    Please check the sample.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion