Results 1 to 10 of 10

Thread: Allow custom vtype by entering in a free field

    Success! Looks like we've fixed this one. According to our records the fix was applied for DSGNR-1954 in a recent build.
  1. #1
    Ext JS Premium Member
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    422

    Lightbulb Allow custom vtype by entering in a free field

    At the Component Config of fields, I can only specify 4 vtypes though a dropdown:
    Sencha designer 2 - enter vtype in free field.JPG

    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

  2. #2
    Ext JS Premium Member
    Join Date
    Sep 2008
    Posts
    110

    Default

    +1

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2009
    Posts
    106

    Default

    +1

  4. #4
    Touch Premium Member
    Join Date
    Dec 2007
    Location
    Ireland
    Posts
    65

    Default

    +1

  5. #5

    Default

    +1

  6. #6
    Sencha User
    Join Date
    Jul 2011
    Location
    RI, USA
    Posts
    1

    Default

    +1

  7. #7
    Ext JS Premium Member
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    422

    Default

    An obvious workaround for now is to add a controller action and set the vtype on beforerender of the field.

  8. #8
    Sencha User
    Join Date
    Oct 2012
    Posts
    2

    Default

    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()

    Code:
    // 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


    Code:
    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";     }
    Last edited by mikeAGF3; 29 Oct 2012 at 6:23 PM. Reason: Referred 'stupid SA2', now removed. M

  9. #9

    Default

    +1

  10. #10
    Sencha User
    Join Date
    Mar 2007
    Posts
    9,488

    Default

    This will be fixed in the 2.2 release.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •