EasyUI Forum
November 06, 2025, 01:59:41 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: Error when working with 2 ComboBox with local data from javascript variable  (Read 12784 times)
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« 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 
});
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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.
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #2 on: January 14, 2014, 01:50:07 AM »

Thx Smiley 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!
« Last Edit: January 14, 2014, 02:13:26 AM by Stefan B. » 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!