View Full Version : Extjs Combobox add extra record
magut212
5 Jul 2012, 5:20 AM
Hi Programmers :-?,
I have a combobox that i would like to add an option for adding an extra record if the record is not in the store.
Regards,
Samuel
Software Developer
skirtle
5 Jul 2012, 3:04 PM
Could you let me know which version of ExtJS you're using so that I can move this question to the appropriate forum?
magut212
5 Jul 2012, 10:16 PM
Hi @skirtle, iam using extjs 4, MVC
sword-it
5 Jul 2012, 11:14 PM
Hi,
You can use following code for set data into combo store
use this listeners with your combo:-
listeners: {
afterrender: {
fn: function (combo) {
var store = combo.getStore()
, storeLength = store.getCount();
if (storeLength <= 0) {
var data = [];
data.push(new Ext.data.Record({
name: 'abc'
}));
data.push(new Ext.data.Record({
name: 'xyz'
}));
store.add(data);
}
}
}
}
scottmartin
6 Jul 2012, 10:13 AM
Another option would be to add a record to the store:
http://www.sencha.com/forum/showthread.php?228925
Scott.
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.