PDA

View Full Version : [FIXED] Allow custom vtype by entering in a free field



devtig
13 Mar 2012, 6:14 AM
At the Component Config of fields, I can only specify 4 vtypes though a dropdown:
32686

I have my custom vtypes that I would like to be able to specify at the Field Component Config.

I suggest you bring back the free text field here at vtype. (Not a bug, but a feature request)

I am using Sencha Designer 2.0.0 Build 311

wurstkuchen
14 May 2012, 12:46 AM
+1

gatherworks
15 May 2012, 3:22 AM
+1

pmarko
4 Jun 2012, 7:21 AM
+1

zouzhijun
5 Jun 2012, 4:35 PM
+1

rbudin
14 Jun 2012, 4:20 AM
+1

devtig
14 Jun 2012, 4:42 AM
An obvious workaround for now is to add a controller action and set the vtype on beforerender of the field.

mikeAGF3
29 Oct 2012, 6:21 PM
Sencha Architect 2 does not yet support custom vtypes [cannot select custom vtype in Property inspector].

2-steps to applying vtype dynamically

1. Define vtype/s in launch()




// Custom/advanced vtypes [form validation] Ext.apply(Ext.form.field.VTypes, { daterange: function(val, field) { /* * Always return true since we're only using this vtype to set the * min/max allowed values (these are tested for after the vtype test) */ var date = field.parseDate(val); if (!date) { return false; } // console.log('validating'); if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) { var start = field.up('form').down('#' + field.startDateField); start.setMaxValue(date); this.dateRangeMax = date; start.validate(); } else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) { var end = field.up('form').down('#' + field.endDateField); end.setMinValue(date); this.dateRangeMin = date; end.validate(); } return true; }, daterangeText: 'Start date must be less than end date', password: function(val, field) { if (field.initialPassField) { var pwd = field.up('form').down('#' + field.initialPassField); return (val == pwd.getValue()); } return true; }, passwordText: 'Passwords do not match' });

2. Add controller action

controlQuery = 'reports' // name of panel
targetType = 'reports' // select from drop-down list
fn = 'initialiseForm'
name = 'beforeshow' // event




initialiseForm: function(abstractcomponent, options) { Ext.data.StoreManager.lookup('fence').load(); Ext.data.StoreManager.lookup('staff').load(); // SA2 cannot apply custom vtype, have to assign dynamically :( var form = this.getController('Main').tabPanel.activeTab.down('form').form; form.findField('start').vtype = "daterange"; form.findField('end').vtype = "daterange"; }

batman3000
12 Mar 2013, 9:49 AM
+1

aconran
12 Mar 2013, 10:39 AM
This will be fixed in the 2.2 release.