EasyUI Forum
November 05, 2025, 02:10:40 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: combobox - bug onSelect  (Read 17014 times)
Rinat
Newbie
*
Posts: 31


View Profile
« 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));
« Last Edit: March 15, 2015, 06:55:14 AM by Rinat » Logged
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #1 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.
Logged
Rinat
Newbie
*
Posts: 31


View Profile
« Reply #2 on: March 15, 2015, 08:30:22 AM »

Thanks! I will try it.
But, This event is not described in the documentation
Logged
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #3 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.
Logged
Rinat
Newbie
*
Posts: 31


View Profile
« Reply #4 on: March 15, 2015, 09:18:59 AM »

Thanks!
PS: Very cool lib!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!