EasyUI Forum

General Category => Bug Report => Topic started by: Rinat on March 15, 2015, 06:45:01 AM



Title: combobox - bug onSelect
Post by: Rinat on March 15, 2015, 06:45:01 AM
Hello!
Sorry, I do not know English, I want to report about this bug

1) I have comobox element.

Code:
 $('#'+prefix+'_city_id').combobox({
        selectOnNavigation: 1,
        valueField: 'id',
        textField: 'city_name',
     //   groupField: 'area',

        formatter: function(row)
        {
            return row.city_name + ' ('+row.area+')';
        },
        data: window.idb_data['cities'],
        onSelect: function (rec)
        {
            $('#'+prefix+'_street_id').combobox({
                url: '/index.php?m=handbooks&a=streets&id=' + rec.id,
                valueField: 'id',
                textField: 'street_name'
            });
        }
    });
2) When i write full text, combobox control select this text, but OnSelect event fails.

I fix this bug, but I do not know if it's right

1.4.2
Code:

function _95f(_965,_966,_967){
var opts=$.data(_965,"combobox").options;
var _968=$(_965).combo("panel");
if(!$.isArray(_966)){
_966=_966.split(opts.separator);
}
_968.find("div.combobox-item-selected").removeClass("combobox-item-selected");
var vv=[],ss=[];
for(var i=0;i<_966.length;i++){
var v=_966[i];
var s=v;
opts.finder.getEl(_965,v).addClass("combobox-item-selected");
var row=opts.finder.getRow(_965,v);
if(row)
{
opts.onSelect.call(_965, opts.finder.getRow(_965, v));
s=row[opts.textField];
}
vv.push(v);
ss.push(s);
}
if(!_967){
$(_965).combo("setText",ss.join(opts.separator));
}
$(_965).combo("setValues",vv);
};

Quote
if(row)
{
opts.onSelect.call(_965, opts.finder.getRow(_965, v));


Title: Re: combobox - bug onSelect
Post by: jarry on March 15, 2015, 08:11:00 AM
The 'onSelect' event fires when the user select a combobox item. If you do not select the items, this event does not fires. You may need to try using 'onChange' event instead.


Title: Re: combobox - bug onSelect
Post by: Rinat on March 15, 2015, 08:30:22 AM
Thanks! I will try it.
But, This event is not described in the documentation


Title: Re: combobox - bug onSelect
Post by: jarry on March 15, 2015, 08:52:44 AM
The 'onChange' event is inherited from combo component. All the combo and its dependent components have the 'onChange' event.


Title: Re: combobox - bug onSelect
Post by: Rinat on March 15, 2015, 09:18:59 AM
Thanks!
PS: Very cool lib!