EasyUI Forum
May 09, 2024, 03:31:05 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Pass Empty Array to ComboBox?  (Read 5430 times)
2plus2
Jr. Member
**
Posts: 75


View Profile
« on: November 11, 2015, 03:23:26 PM »

When the remote call returns an empty array "[]" to the combobox, should the combobox clear existing options or should there be no change?

e.g.
Code:
$('#billingYear').combobox('reload', '/controls/ajax.aspx?a=getYears&Customer_Id=' + x + '&Serial=' + y);

This call can return "nothing" as a valid response, e.g. "[]". I would expect the combobox to clear all existing values. Instead it stays unchanged.

using version 1.4.3
« Last Edit: November 12, 2015, 08:19:03 AM by 2plus2 » Logged
arma
Full Member
***
Posts: 110


View Profile
« Reply #1 on: November 11, 2015, 04:21:14 PM »

You can clear the combobox before reloading.
$('#billingYear').combobox('loadData',[]);
Logged
2plus2
Jr. Member
**
Posts: 75


View Profile
« Reply #2 on: November 12, 2015, 08:18:26 AM »

Thanks.

I'm currently checking the loaded data and using the clear option as a workaround. But I would think that on receiving a blank array the combobox would clear itself.

Code:
       onLoadSuccess: function (combo) {
            if (combo.length == 0) {
                $('#billingYear').combobox('clear');
            }
       },

I'll have to test and see if this behavior is consistent on older versions of jEasy.
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!