View Full Version : TriggerField with dynamicaly changing emptyText
I wanted to configure the empty text attribute in the triggerField depending upon a selection happening in another combobox.
EX: when the trigger field is loaded there is some default value in the emptyText attribute. Next there is a combobox which would show a list of item... On selecting a particular item from the combo... I need to display a hint sort of a thing in the triggerField...
Couldnot find API's to do the same. What is the best way to achieve this ?
Condor
30 Sep 2009, 7:08 AM
Try:
field.emptyText = 'New text';
field.applyEmptyText();
It doesnt work.. Doesnt show any error either !
Infact if you've already specified emptyText while configuring the component, (the above sol) doesnt overwrite the configured value.
Also if u donot specify any emptyText while configuration, and then using the above way.. try to set the emptyText multiple times.... It doesnt work..it sets to the first occurrance !
Condor
30 Sep 2009, 9:51 AM
Can you post your code?
Ext.get(document.body).update('<div id="test"></div>');
var a=new Ext.form.TwinTriggerField({
renderTo: 'test',
autoWidth: true,
id:'globalSearch',
trigger1Class: 'x-form-search-trigger',
trigger2Class:'x-form-dropdown-trigger',
emptyText:'Search...',
onTrigger1Click :function() {
alert("dropdown trigger");
},
onTrigger2Click : function() {
alert("dropdown trigger");
}
});
a.emptyText='newText';
a.applyEmptyText();
this will the set the value of emptyText to 'Search...'
Ext.get(document.body).update('<div id="test"></div>');
var a=new Ext.form.TwinTriggerField({
renderTo: 'test',
autoWidth: true,
id:'globalSearch',
trigger1Class: 'x-form-search-trigger',
trigger2Class:'x-form-dropdown-trigger',
onTrigger1Click :function() {
alert("dropdown trigger");
},
onTrigger2Click : function() {
alert("dropdown trigger");
}
});
a.emptyText='newText';
a.applyEmptyText();
where as if you donot specify empty text during configuration , as in the above case it will set it to newText. However once the value to emptyText is set it cannot be reset from anywhere else using
a.emptyText='newText';
a.applyEmptyText();
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.