Adding the data written to the cell to the validation with the changelistiner

0 Answers 66 Views
Spreadsheet
kypdk
Top achievements
Rank 1
Iron
kypdk asked on 30 Jun 2022, 11:32 AM | edited on 01 Jul 2022, 06:27 AM

Hello,

const processesList: string[] = ["Process 1","Process 2","Process 3"];

 

I want to add the word I wrote in the cell to the "list of validation" if it is not in the current list.

 

  SpreadValidation() {
    var spreadsheet = kendo.jQuery(this.spreadsheetEl.nativeElement).data("kendoSpreadsheet");
    var sheet = spreadsheet.activeSheet();
    const processesMerge = '"'+processesList.toString()+'"';
   
    sheet.range("B:AX").validation({
      dataType: "list",
      showButton: true,
      comparerType: "list",
      from: processesMerge,
      allowNulls: true,
      type: "warning"
    });
  }

 

change listener code

   var spreadsheet = kendo.jQuery(this.spreadsheetEl.nativeElement).data("kendoSpreadsheet");
    spreadsheet.bind("changing", this.changeListener);

 

  changeListener(e) {
    console.log("The netered value is: "+e.data);
    processesList.push(e.data);
    var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
    var sheet = spreadsheet.activeSheet();
    const progressMerge = '"'+processesList.toString()+'"';
   
    sheet.range("B:AX").validation({
      dataType: "list",
      showButton: true,
      comparerType: "list",
      from: progressMerge,
      allowNulls: true,
      type: "warning"
    });    
}

 

 

I can capture the data I entered in the cell, but I could not add this word to the current validation list. how can I do it ?

My goal is that if the added word is not in the validation list, it will be added, and if there is, it will not repeat the data. in this way, it is always to increase the list and to be able to make a selection from the existing ones.

 

kypdk
Top achievements
Rank 1
Iron
commented on 01 Jul 2022, 07:14 AM

 

  processesList.push(e.data);
  const processesMerge = '"'+processesList.toString()+'"';
  var range = e.range;
  var validation = range.validation();
  validation.from = processesMerge;
  range.validation(validation);

 

like this, it just adds the cell I changed to the validation. I want this list to change in all validations between B:AX

 

Can I access the spreadsheet from e?

 

 

kypdk
Top achievements
Rank 1
Iron
commented on 01 Jul 2022, 07:47 AM | edited

Solved

  changeListener(e) {
    processesList.push(e.data);
    const processesMerge = '"'+processesList.toString()+'"';
 
    var sender = e.sender;
    sender.sheetByName("process").range("B:AX").validation({
      dataType: "list",
      showButton: true,
      comparerType: "list",
      from: processesMerge,
      allowNulls: true,
      type: "warning"
    });
   
   
  }

No answers yet. Maybe you can help?

Tags
Spreadsheet
Asked by
kypdk
Top achievements
Rank 1
Iron
Share this question
or