This is a migrated thread and some comments may be shown as answers.

Focus lost on asyncronous data binding

1 Answer 56 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ovidiu
Top achievements
Rank 1
Ovidiu asked on 21 Oct 2013, 07:35 AM
Hello,

We encounter the following issue,
- a form with many combobox-es each of them will load its items using ajax from the server using ServerFiltering (true)
- sometime obtaining the filtered items takes a bit, and our users just go ahead and start to fill in the next combobox in the form.
- problem is that at some point the previous combo async operation completes and the dropdown of previous combobox will open and the focus is shifted back to the previous control

The behavior we consider appropriate here would be that the previous combo handles silently the end of async operation if it is no longer focused control on the form.
Can this behavior achieved somehow with current version.

As a side note there was something similar with TabStrip control where asynchronous tab contents were stacked as the asynchronous operation completed, I see now that this was solved in the last internal build (2013.2.1015) perhaps you can consider a similar fix for the combo async behavior explained above.

Thanks
Ovidiu

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 23 Oct 2013, 08:57 AM
Hello Ovidiu,

I am afraid that currently there is no built-in solution for changing this behavior, however you could do the following:  
  1. Use the ComboBoxes' open event to set store the ID of the last opened ComboBox
  2. Attach a handler to the close event and check if the ID of the last ComboBox is different from the current
  3. In case the IDs do not match use the preventDefault method
Here is an example:  
var lastComboBox = null;  
$("#combo1").kendoDropDownList({
    close: function(e){
        if (lastComboBox != 1) {
            e.preventDefault();
        }
    },
    open: function () {
        lastComboBox = 1;
    }
});
 
$("#combo2").kendoDropDownList({
    close: function(e){
        if (lastComboBox != 2) {
            e.preventDefault();
        }
    },
    open: function () {
        lastComboBox = 2;
    }
});

 

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ComboBox
Asked by
Ovidiu
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or