2017-09-07 3 views

答えて

0

新しいオプションを追加し、SelectizeのAPIで利用可能なcreateItemupdateOptionメソッドにその値の使用をカスタマイズすることができます。チェックthis fiddle.

0
Its working for me like 
$(function(){ 
     $('#desig').selectize({ 
      create:function (input, callback){ 
       $.ajax({ 
        url: "<?php echo $this->url(null, array('controller' => 'employee-detail', 'action' => 'add-new-desig-ajax'));?>", 
        type: 'POST', 
        data:{'designation':input}, 
        success: function (result) { 
         if (result) { 
//       console.log('sdfasf',result); 
          callback({ value: result.id, text: input }); 
         } 
        } 
       }); 
      } 
     }); 
    }); 

I have taken help from here 
https://stackoverflow.com/questions/24366365/creating-an-item-if-not-already-exists-in-selectize-js-select-box-and-ajax-updat/46096111#46096111 
関連する問題