PDA

View Full Version : customizing yes no combo within a specific panel without affecting parent combo box



umbregachoong
6 Dec 2013, 9:45 AM
Hello.

I am back, with a new question. I need to customize the yes no combo within a specific panel, local to the panel without affecting the parent yesnocombo box configuration. Is there a way to do this?

I am referring to the form I posted earlier in another thread:
http://www.sencha.com/forum/showthread.php?276777-Attempting-to-add-radio-buttons-and-columns-in-an-existing-Sencha-form

I tried this:

var myNewStore =[
"", "Yes", "Revoke"];
Ext.define('YesNoCombo',{
extend:'Ext.form.ComboBox',
store:myNewStore,
value:'',
emptyText:'Select...',
labelalign:'left',
labelWidth:550,
inputWidth:80,
allowBlank:true,
listeners:{
select:function(comp,record,index){
if(comp.getVelue() == "" || comp.getVale() ==="&nbsp")
comp.setValue(null);
}
}
});

but this broke the format of the form.

Is there a way to create a local combo with custom variables like this:

var UserForm_BlahBlahBlah=Ext.create('YesNoCombo', {
name:"UserForm_BlahBlahBlah",
fieldLabel:"BlahBlahBlah",
values:" Yes" "Revoke",
});

?

I tried this but it will not work. But you get the idea- It is just creating a local extension within a specific panel with new values.

Is this possible? Or is there a better way that sencha implements customizing the combo box with out affecting the parent class?

Regards,
umbre gachoong

Farish
7 Dec 2013, 11:31 PM
you have to provide it with a different store with the new values. The list shown in a combobox gets its values from the store attached to that combobox. the value config can be used to select a value from that list by default (otherwise, the combobox has no selection).

umbregachoong
9 Dec 2013, 12:25 PM
I created a new store like this:

var myNewStore =[
"Yes", "Revoke"
];
Ext.define('YesNoCombo',{
extend:'Ext.form.ComboBox',
store:myNewStore,
value ...etc.,

and made the call like so:

var UserForm_BlahBlah = Ext.create('YesNoCombo',{
store:myNewStore,
etc.

However, I noticed some customized combos doing this:

var UserForm_blahblah=Ext.create('YesNoCombo',{
store:[''","Blah","Blah-Blah"],
value:'',
name:"BlahBlahExample",
etc.

Is this another way of doing customization?

Thanks.

Farish
9 Dec 2013, 11:47 PM
please take a look at the documentation for store and combobox:

http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.data.Store

you can see in the example code how a store is created and how a combobox uses it.

umbregachoong
10 Dec 2013, 8:36 AM
Thanks for your help!
Regards,
umbre gachoong