jeudi 11 août 2016

jeditable dynamic select options

I have a page that it using jEditable, and I want to load dynamically the options of a picklist (Depending of the current element).

I have the following example in fiddle: http://ift.tt/2aVkZRH

$(document).ready(function() {
     $('.edit').editable(function(value, settings) { 
       console.log(this);
       console.log(value);
       console.log(settings);
       return(value);
     }, { 
       data : " {'E':'E','F':'F','G':'G', 'selected':'F'}", // <---- I WANT TO CHANGE THIS CODE
       // ******************************************
       // DYNAMIC LOAD - DEPENDING OF THE ELEMENT ID
       // ******************************************
       // data :  function(currentElement) { 
       //           if(currentElement.id == "A") return " { '1':'1', '2':'2', '3':'3' }"; 
       //     else return " { 'A':'A', 'B':'B', 'C':'C' }"; 
       // }
       type : 'select',
       onblur: 'submit'
     });                                
 });

I want retrieve the list of specific options depending of the element. This could be possible?

Aucun commentaire:

Enregistrer un commentaire