-
13 Feb 2013 2:06 AM #1
Prevent setting readOnly on Trigger Field hiding trigger
Prevent setting readOnly on Trigger Field hiding trigger
Title says it all really. This was really easy to override in Ext 3 but no so much in Ext 4 as the updateLayout function is much more convoluted.
So, is there a way in Ext 4 to prevent the trigger element from being set to invisible when clicking a trigger is calling readOnly = true on the field?
-
14 Feb 2013 9:29 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,637
- Vote Rating
- 435
Something like this?
Code:Ext.define('Ext.ux.CustomTrigger', { extend : 'Ext.form.field.Trigger', alias : 'widget.customtrigger', readOnly : true, getTriggerMarkup : function() { this.readOnly = false; var ret = this.callParent(); this.readOnly = true; return ret; } }); Ext.create('Ext.form.FormPanel', { title : 'Form with TriggerField', bodyPadding : 5, width : 350, renderTo : Ext.getBody(), items : [ { xtype : 'customtrigger', fieldLabel : 'Sample Trigger', emptyText : 'click the trigger' } ] });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
21 Feb 2013 1:23 PM #3
Nope. Your code doesn't work for a couple of reasons:
1. The trigger is created in a poor position - see screenshot
2. Clicking the trigger doesn't change the readOnly status of the field - it's always read only.
The requirement is to have a trigger field that, when user clicks it's trigger toggles from read only to writable and vice versa. The trigger should not vanish on making the field readOnly as is the default behaviour currently in Ext


Reply With Quote