tabalinas / jsgrid

Lightweight Grid jQuery Plugin
http://js-grid.com
MIT License
1.53k stars 353 forks source link

Detect value of selected value when inserting a new item #1422

Open caldera500 opened 1 year ago

caldera500 commented 1 year ago

Is there a way to detect when the value of a dropdown gets changed when inserting a new item. I want to disable some of the other inputs depending on the value that is detected.

{insertTemplate: function(value, item){
  if(item.value == 'A'){
   $("#grid").jsGrid("fieldOption", "Size", "inserting", false);
},
 name: 'category', title: 'Category', type: 'select', 
      items:['', A ', 'B', 'C, 'D']},

I can detect the value of the dropdown like this:

$(document).on('change','#grid .jsgrid-insert-row select',function(){
  console.log("change detected", this.value);
});

However setting the field option after the grid is created is not possible using $("#grid").jsGrid("fieldOption", "Size", "inserting", false);