EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: arma on December 04, 2013, 04:29:41 PM



Title: Add Combo Option
Post by: arma on December 04, 2013, 04:29:41 PM
Hi,

Is there a way to add a combobox option manually into combobox which load data with url property ?

Code:
$('#cb-product-option-pattern').combobox({
                        url: 'product/option/pattern',
                        editable: false,
                        valueField: 'id',
                        textField: 'text',
                        multiple: true,
                        panelHeight: 'auto',
                        width: 425
                    });

//Add some option here to combobox above manually from local data

Thanks.


Title: Re: Add Combo Option
Post by: iceh on December 05, 2013, 04:25:25 AM
I suggest using the $.ajax() of jquery, then you can filter your data
and apply the rest to the cb via the .data property.

e.g.

var data = ... from ajax

the filter ...

now data has e.g.

data = " [{
         label: 'java',
         value: 'Java'
      },{
         label: 'perl',
         value: 'Perl'
      },{
         label: 'ruby',
         value: 'Ruby'
      }]";

$('#cc').combobox({
   data: data
});