easyui editor combobox multiple

 1 $.extend($.fn.datagrid.defaults.editors,{
 2     combobox: {
 3         init: function(container, options){
 4             var combo = $('<input type="text">').appendTo(container);
 5             combo.combobox(options || {});
 6             return combo;
 7         },
 8         destroy: function(target){
 9             $(target).combobox('destroy');
10         },
11         getValue: function(target){
12             var opts = $(target).combobox('options');
13             if (opts.multiple){
14                 return $(target).combobox('getValues').join(opts.separator);
15             } else {
16                 return $(target).combobox('getValue');
17             }
18         },
19         setValue: function(target, value){
20             var opts = $(target).combobox('options');
21             if (opts.multiple){
22                 if (value == ''){
23                     $(target).combobox('clear');
24                 } else {
25                     $(target).combobox('setValues', value.split(opts.separator));
26                 }
27             } else {
28                 $(target).combobox('setValue', value);
29             }
30         },
31         resize: function(target, width){
32             $(target).combobox('resize', width)
33         }
34     }
35 });

 

posted @ 2013-10-20 16:47  少爵  阅读(1339)  评论(0编辑  收藏  举报