1. #1
    Sencha User
    Join Date
    Oct 2008
    Posts
    9
    Vote Rating
    0
    derickito is on a distinguished road

      0  

    Default SelectField and placeHolder

    SelectField and placeHolder


    Right now placeHolder is kinda useless with a selectfield. Eventhough the placeholder attribute is added to the input field, the field will never be empty unless you have an empty option. I'm trying to avoid having to do that. Am I overlooking something obvious? Appreciate any help. Here's my config object:

    Code:
    Mobi.controls.search.propertyType = {
      xtype: 'selectfield',
      name: 'property_class_id',
      placeHolder: 'Select Type',
      label: 'Type',
      options: [
    	{text: 'Single Family', value: 1},
    	{text: 'Townhome/Condo', value: 2},
    	{text: 'Highrise Condominium', value: 6},
    	{text: 'Residential Lots & Land', value: 3},
    	{text: 'Multi-Family', value: 4},
    	{text: 'Country Home / Acreage', value: 5}
      ],
      listeners: {
    	//afterrender: Mobi.cb.afterSFRender,
    	afterrender: function(){
    	  Mobi.cb.afterSFRender.call(this);
    	  Ext.EventManager.on(this.getEl(), 'swipe', Mobi.cb.criteriaSwipe);
    	},
    	orientationchange: Mobi.cb.selectChangeOrientation
      }
    };

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Posts
    27
    Vote Rating
    0
    lpfx is on a distinguished road

      0  

    Default


    I'm having the same problem ...

    Anyone?

  3. #3
    Sencha User tomalex0's Avatar
    Join Date
    Apr 2009
    Location
    San Jose, CA
    Posts
    589
    Vote Rating
    16
    tomalex0 will become famous soon enough

      0  

    Default


    Can you try below selectfield override and use placeholder option. It should work. Let me know if there is any issue. Check in iphone device also.
    Code:
    Ext.override(Ext.form.Select, {
       setValue : function(v) {
    		var record = v ? this.store.findRecord(this.valueField, v) : '',
                hidden = this.hiddenField, displayval = "",setrecord, val = v;
            if (record && this.rendered) {
    			console.log("if");
                this.fieldEl.dom.value = record.get(this.displayField);
                this.value = record.get(this.valueField);
            } else {
    			console.log("else");
                setrecord = this.store.findRecord(this.valueField, v);
                if (setrecord){
                    val = v ;
                    displayval = setrecord.get(this.displayField);
                }
                this.value =  val;
                if(this.fieldEl){
                   this.fieldEl.dom.value = displayval;
                }
            }
            if (hidden) {
                hidden.value = this.value;
            }
            return this;
        }
    });
    Sencha Touch Demos

    IosToggleField Forum - Github
    Form Validation
    Forum - Github
    Iphone Settings Menu
    Forum
    Sqlite Storage & Login Manifest
    Forum
    KitchenSink MVC
    Forum - Github
    SqliteProxy-v1 Forum - Github
    SqliteProxy-v2
    Forum - Github
    Arshaw Fullcalendar Forum - Github






Thread Participants: 2

Tags for this Thread