Hybrid View

  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    France
    Posts
    223
    Vote Rating
    0
    tof is on a distinguished road

      0  

    Default FormLayout : Prefix/Suffix to form fields

    FormLayout : Prefix/Suffix to form fields


    Juste a modification of FormLayout to have suffix and/or prefix on fields.
    Ex :

    [PHP]new Ext.form.FormPanel({
    ...,
    items : [{
    xtype : 'fieldset',
    name : 'price',
    fieldLabel : 'Price',
    suffix : '

  2. #2
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    4
    mystix will become famous soon enough

      0  

    Default


    for some strange reason vBulletin erased practically all of @tof's code.

    i'm reposting what i copied from the post, plus a fix by @condor, plus some custom-added stuff to display an asterisk for allowBlank:false fields (in a <span> tag with a class of "x-form-field-asterisk" -- add your own custom CSS to style it):
    Code:
    Ext.override(Ext.layout.FormLayout, {
        // enable Field prefix / suffix (additional text before/after the input element)
        // by @tof -- http://extjs.com/forum/showthread.php?t=15252
        renderItem : function(c, position, target) {
            if (c && !c.rendered && c.isFormField && c.inputType != 'hidden') {
                var args = [
                    c.id,
                    c.fieldLabel + (c.allowBlank? '' : '<span class="x-form-field-asterisk"> * </span>'),
    
                    // bugfix for "FormLayout labelStyle breaks hideLabels, labelAlign and labelWidth"
                    // by @condor -- http://www.extjs.com/forum/showthread.php?p=228652#post228652
                    (this.labelStyle || '') + ';' + (c.labelStyle || ''),
    
                    this.elementStyle || '',
                    typeof c.labelSeparator == 'undefined' ? this.labelSeparator : c.labelSeparator,
                    (c.itemCls || this.container.itemCls || '') + (c.hideLabel ? ' x-hide-label' : ''),
                    c.clearCls || 'x-form-clear-left'
                ];
                if (typeof position == 'number') {
                    position = target.dom.childNodes[position] || null;
                }
                if (position) {
                    this.fieldTpl.insertBefore(position, args);
                } else {
                    this.fieldTpl.append(target, args);
                }
    
                var newEl,
                    fEl = Ext.get('x-form-el-' + c.id);
    
                c.render(fEl);
    
                if (c.prefix) { // Field prefix
                    if (c.isXType('trigger')) {
                        newEl = c.wrap.insertHtml('afterBegin',  '<span>' + c.prefix + '&nbsp;</span>', true);
                        c.el.setWidth(c.el.getWidth() - c.trigger.getWidth() - newEl.getWidth());
                    } else {
                        newEl = fEl.insertHtml('afterBegin',  '<span>' + c.prefix + '&nbsp;</span>', true);
                        c.el.setWidth(c.el.getWidth() - newEl.getWidth());
                    }
                }
    
                if (c.suffix) { // custom field suffix addition by @tof
                    if (c.isXType('trigger')) {
                        newEl = c.wrap.insertHtml('beforeEnd', '<span>&nbsp;' + c.suffix + '</span>', true);
                        c.el.setWidth(c.el.getWidth() - c.trigger.getWidth() - newEl.getWidth());
                    } else {
                        newEl = fEl.insertHtml('beforeEnd', '<span>&nbsp;' + c.suffix + '</span>', true);
                        c.el.setWidth(c.el.getWidth() - newEl.getWidth());
                    }
                }
            } else {
                Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);
            }
        }
    });

  3. #3
    Ext User
    Join Date
    Apr 2009
    Posts
    13
    Vote Rating
    0
    yroman is on a distinguished road

      0  

    Default


    I'd like to inquire how such modifications affect ExtJS update process? For example if I want to update ExtJS library to the next version, not major but minor, what is the probability that such fix will be broken?

    Thank you!

  4. #4
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    4
    mystix will become famous soon enough

      0  

    Default


    Quote Originally Posted by yroman View Post
    I'd like to inquire how such modifications affect ExtJS update process? For example if I want to update ExtJS library to the next version, not major but minor, what is the probability that such fix will be broken?

    Thank you!
    i really wouldn't know.
    all i know for sure is: there's only one way to find out.

  5. #5
    Ext User
    Join Date
    Jun 2009
    Location
    Belgium
    Posts
    2
    Vote Rating
    0
    Celestemmcknight is on a distinguished road

      0  

    Default FormLayout Prefix/Suffix to form fields

    FormLayout Prefix/Suffix to form fields


    suffix_array is nil. What method is that code in and in what class? There are so many scripts in your game, one of them is probably calling that method before the prefix/suffix script expects it to be called.

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    35
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Spammers eh?

    Weird little people. Who knows what goes on in their tiny minds?

  7. #7
    Ext User
    Join Date
    Oct 2009
    Posts
    14
    Vote Rating
    0
    ExtJSNewUser is on a distinguished road

      0  

    Default Label Alignments

    Label Alignments


    Hi Animal,

    I need your help. I have a form with few fields in it. I want to set the labelAlign for certain fields like text areas. if it is TextArea the Label is on top of text Area. and if it is a regular text field they are normally side by side. only I want to change the alignment if it is a textarea in my form.
    labelAlign:'top' is applying to whole form. if I put this

    {
    xtype:
    'textarea',
    name:
    'txtUpdReason',
    style:
    "background:#ededed;",
    labelAlign:
    'top',
    readOnly:
    true,
    height: 100,
    width: 100,
    labelAlign:'top',
    anchor:
    '100%',
    fieldLabel:
    'Update Reasons'
    }

    No Effects.

  8. #8
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    35
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Unfortunately, labelAlign is fixed at the Container level right now.

  9. #9
    Ext User
    Join Date
    Oct 2009
    Posts
    14
    Vote Rating
    0
    ExtJSNewUser is on a distinguished road

      0  

    Default


    Thanks Animal

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar