473,467 Members | 1,981 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to populate combobox with data in extjs 2.3?

33 New Member
Here is my code for combobox which is in FormPanel:

Expand|Select|Wrap|Line Numbers
  1. var dept_names = [
  2.         ['1','Electronics and Communication'],
  3.         ['2','Electrical and Electronics'],
  4.         ['3','Telecommunication Engineering'],
  5.         ['4','Instrumentation and Electronics Engineering']
  6.     ];
  7.  Code for combobox in FormPanel: 
  8. {  
  9. xtype:'combo',
  10.  
  11.             fieldLabel:'Department Name',
  12.  
  13.             allowBlank:false,
  14.  
  15.             autoShow:true,
  16.  
  17.             id:'department',
  18.  
  19.             name:'department',
  20.  
  21.             emptyText:'Select the Department from the List',
  22.  
  23.             selectOnFocus:true,
  24.  
  25.             forceSelection:true,
  26.  
  27.             resizable:true,
  28.  
  29.             store: new Ext.data.SimpleStore({
  30.                   id:0,
  31.  
  32.                   autoLoad:true,
  33.  
  34.                     fields:
  35.                     [
  36.                         'deptId',   
  37.                         'deptName' 
  38.                     ]
  39.  
  40.                     ,data:dept_names
  41.  
  42.                 })
  43.  
  44.             ,valueField:'deptId'
  45.             ,displayField:'deptName'
  46.             ,hiddenName:'deptId'
  47.             ,mode:'local'
  48.  
  49. }
  50.  
When i run it i'm getting the combobox and getting emptyText also...
But the data given in the dept_names is not getting populated :(

Please do help me.
Thanks in advance.
May 5 '10 #1
3 9219
RamananKalirajan
608 Contributor
Hi,
Here with I have attached a sample code. I created this one with Ext 2.1

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <link rel="stylesheet" type="text/css" href="ext-2.1/resources/css/ext-all.css" />
  4. <script type="text/javascript" src="ext-2.1/adapter/ext/ext-base.js"></script>
  5. <script type="text/javascript" src="ext-2.1/ext-all.js"></script>
  6. <link rel="stylesheet" type="text/css" href="ext-2.1/examples/shared/examples.css" />
  7.  
  8. </head>
  9. <body>
  10. <div>
  11.     Department Names: <input type="text" id="yourCombo">
  12.  </div>
  13.  <script type="text/javascript">
  14.  
  15. Ext.namespace('Ext.deptdata');
  16.  
  17. Ext.deptdata.dept = [['Electrionics and Communication', 'Electronics and Communication'],
  18.         ['Electrical and Electronics', 'Electrical and Electronics'],
  19.         ['Information technology', 'Information technology'],
  20.         ['TeleCommunication', 'TeleCommunication']];
  21.  
  22. var combo1 = new Ext.form.ComboBox({
  23.     store: Ext.deptdata.dept,
  24.     displayField:'deptName',
  25.     typeAhead: true,
  26.     mode: 'local',
  27.     triggerAction: 'all',
  28.     emptyText:'Select the Department from the List',
  29.     selectOnFocus:true,
  30.     applyTo: 'yourCombo'
  31. });
  32. </script>
  33. </body>
  34.  
  35. </html>
Thanks and Regards
Ramanan Kalirajan
May 5 '10 #2
vibhakhushi
33 New Member
Hello RamananKalirajan... I tried with the example you gave me, but still i'm not getting the drop down list. I checked for store getting data, its getting. I dont know why i'm not getting the drop down list. Can you tell me where i am going wrong.
Jun 2 '10 #3
RamananKalirajan
608 Contributor
Please check for the path and everything. Post the code what you have tried and please let us know whether are you getting any exception

Thanks and Regards
Ramanan Kalirajan
Jun 2 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jassim Rahma | last post by:
Hi, what is the best way to populate comboBox from database.. the reason I am asking is that i have more than 8 comboBoxes in one form and each should retrieve data from a table and I don't want...
0
by: Hyper X | last post by:
Hey guys, I have about 150 forms using the ComboBoxes. There is at least one combobox in every form. I am filling the comboboxes on FormLoad of every form. Eg., Fill Staff table on form...
9
by: Mike L | last post by:
I tried a sample of code in MSDN magazine, but now I'm stuck. What code has the best performance to populate a Data Grid with a SP? Below is the code I have, which might be completing the wrong...
2
by: Sean Holt via DotNetMonster.com | last post by:
In my application I have about 15 comboboxes and checkboxes scattered throughout 5 tabs. After I populate the combobox and try to null it out (by just highlighting and deleteing), the data...
11
by: DSR | last post by:
Help Please... I would like to populate a combo box on a form with a query that compares data from two tables. Any record that is unique in table1 should continue to populate my combobox. The...
16
by: agrawal.solutions | last post by:
Hello Friends I am asking a very silly question but i dont find any solution fo this.. I am selectiong a recordset and want to populate a combobox where id would be inviseble and the content...
0
by: vnaz235 | last post by:
Hi, guys, 1. Can anybody help me to populate ComboBox on VB6 form with a) text strings from the range on the already existing Excel sheet (e.g.,...
1
by: freekedoutfish | last post by:
Hi. New member here Im sat at work, pounding my head off the desk because this tiny bit of simple code refuses to work. The sub is intended to pull data from the "companyname" column in the...
1
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, I've a column in a dataGridView set as combobox. I can't find any example showing how to populate the list in the combobox. Does anyone have an example showing me this. Regards Jesper.
1
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
This actually stemmed from anther post I created. But, I have two combo boxes. ComboBox1 is populated by a list of Systems (DataSet from Oracle Query). Now, I want to take Combobox2, and when...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.