EasyUI Forum

General Category => Bug Report => Topic started by: Stefan B. on January 14, 2014, 01:20:36 AM



Title: Error when working with 2 ComboBox with local data from javascript variable
Post by: Stefan B. on January 14, 2014, 01:20:36 AM
Using jQuery EasyUI 1.3.5 Release.

i have two combobox in my code. This combobox use the same data object to show the values. The data loaded from a database and the result is an JSON Object saved in one JavaScript variable called gbAllEmployees.

Code:
$.post('getAllEntities.do?eN=dataRecording.masterData.Employee', function(result) {
  gbAllEmployees = result;
  console.log(gbAllEmployees);
});

The error is, that i can only select the data in the second combobox on the webpage. On the first shown combobox the values cannot be selected!
It is very strange. If I use load data direct from url all is fine.

Code:
 $('#wvProjectLead').combobox({  
    width:'220',
    panelWidth:'220',
    mode: 'local',
    valueField:'id',
    textField:'lastName',
    data:gbAllEmployees 
});

 $('#wvRevPlaner').combobox({ 
    width:'220',
    panelWidth:'220',
    mode: 'local',
    valueField:'id',
    textField:'lastName',
    data:gbAllEmployees 
});


Title: Re: Error when working with 2 ComboBox with local data from javascript variable
Post by: stworthy on January 14, 2014, 01:24:28 AM
Please use a separate data in a combobox. Try this:
Code:
$('#wvProjectLead').combobox({  
    width:'220',
    panelWidth:'220',
    mode: 'local',
    valueField:'id',
    textField:'lastName',
    data:$.extend(true,[],gbAllEmployees)
});

 $('#wvRevPlaner').combobox({ 
    width:'220',
    panelWidth:'220',
    mode: 'local',
    valueField:'id',
    textField:'lastName',
    data:$.extend(true,[],gbAllEmployees) 
});

Or download the updated combobox plugin from http://www.jeasyui.com/easyui/plugins/jquery.combobox.js and include it in the page.


Title: Re: Error when working with 2 ComboBox with local data from javascript variable
Post by: Stefan B. on January 14, 2014, 01:50:07 AM
Thx :) Your tip with separate data in a combobox is working.
Code:
 data:$.extend(true,[],gbAllEmployees)

Also the fix in http://www.jeasyui.com/easyui/plugins/jquery.combobox.js is working!