PDA

View Full Version : add item into combo box aftert is loaded xml file



fastwings
21 Aug 2009, 4:38 AM
how i add item to be first one

categorysDS: new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: Config.Xmls[0].GetCategorys
}),
reader: new Ext.data.XmlReader(
{ record: 'Item', id: 'Id' },
[{ name: 'Name' }, { name: 'Id', type: 'int'}]
),
autoLoad: true
}),
//build combo
buildComboCategoryList: function() {

this.categorysDS.insert(0, new Ext.data.Record({ Id: -1, Name: 'No Parent' }));
var combo = new Ext.form.ComboBox({
store: this.categorysDS,
id: 'categoryParentId',
valueField: 'Id',
displayField: 'Name',
//typeAhead: true,
fieldLabel: this.categoryComboName,
title: this.categoryComboNameTitle,
emptyText: this.categoryComboNameEmptyText,
mode: 'local',
forceSelection: true,
width: 270,
triggerAction: 'all'
});
var continer = new Ext.form.FieldSet({
title: this.categoryComboFieldText,
collapsible: true,
autoHeight: true,

autoWidth: true,
defaults: { width: 200 },
defaultType: 'textfield',
items: combo
});


return continer;
}
i try this.categorysDS.insert(0, new Ext.data.Record({ Id: -1, Name: 'No Parent' }));
this.categorysDS.reload();
and this.categorysDS.insert(0, new Ext.data.Record({ Id: -1, Name: 'No Parent' }));
both not working.
its or ignore at or its replace at i need just to add at first like
its like default value on combo

fastwings
21 Aug 2009, 11:02 AM
any one????