Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Select field to no selection.

  1. #11
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    27
    Vote Rating
    0
      0  

    Default

    Hi,

    Do any one got solution for this? How to have place holder for selection field.

    Thanks

    Gayathri

  2. #12
    Sencha User
    Join Date
    Sep 2011
    Posts
    4
    Vote Rating
    0
      0  

    Default

    If you want placeHolder to work properly use setOptions([]) instead of options:[].

    http://stackoverflow.com/questions/7...holder-for-tex

    But this solution is incomplete because the popup always shows up with the first item selected, and clicking that item simply deselects it, so you have to click it again to close the popup. I cannot figure out how show the popup with no selection by default.

  3. #13
    Sencha User
    Join Date
    Dec 2007
    Location
    Grand Rapids, MI USA
    Posts
    18
    Vote Rating
    0
      0  

    Default

    Here's how I did it:

    Code:
    Ext.override(Ext.form.Select, {
    	setValue : function(value) {
    		var idx = -1,
    			hiddenField = this.hiddenField,
    			record = null,
    			dispval = "";
    		
    		if (value) idx = this.store.findExact(this.valueField, value);
    		if (idx != -1) record = this.store.getAt(idx);
    		
    		if (record) {
    			this.value = record.get(this.valueField);
    			dispval = record.get(this.displayField);
    		} else {
    			// record not found
    			this.value =  '';
    			dispval = this.placeHolder;
    		}
    		if (this.rendered){
    			this.fieldEl.dom.value = dispval;
    			if (hiddenField) hiddenField.dom.value = this.value;
    		}
    		
    		// Temporary fix, the picker should sync with the store automatically by itself
    		if (this.picker) {
    			var pickerValue = {};
    			pickerValue[this.name] = this.value;
    			this.picker.setValue(pickerValue);
    		}
    
    		return this;
    	}
        ,showComponent: function() {
    		if (Ext.is.Phone) {
    			var picker = this.getPicker(),
    				name   = this.name,
    				value  = {};
    
    			value[name] = this.getValue();
    			picker.show();
    			picker.setValue(value);
    		} else {
    			var listPanel = this.getListPanel(),
    			index = this.store.findExact(this.valueField, this.value);
    
    			listPanel.showBy(this.el, 'fade', false);
    			if (index != -1) listPanel.down('#list').getSelectionModel().select(index, false, true);
    		}
        }
    });

  4. #14
    Sencha User
    Join Date
    Jun 2012
    Posts
    1
    Vote Rating
    0
      0  

    Default Select field to no selection

    Try the below code:

    Ext.getCmp('selectionfieldId').setValue(" ");
    You can specify any text between the quotes.

  5. #15
    Sencha User
    Join Date
    Oct 2012
    Posts
    62
    Vote Rating
    0
      0  

    Default

    I have the same problem ,have you solved it? Please what is the solution???

Page 2 of 2 FirstFirst 12

Similar Threads

  1. get text in select. Not the selection
    By sofway in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 26 Mar 2010, 7:13 AM
  2. text selection in 'center' during menu select
    By andynuss in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 11 Jul 2009, 4:49 AM
  3. How i know when a Checkbox Selection model is a select or deselect?
    By vanderbill in forum Ext GWT: Help & Discussion (1.x)
    Replies: 3
    Last Post: 11 Feb 2009, 3:46 PM
  4. Selection on ComboBox doesnt select an item
    By digitalkaoz in forum Ext.air for Adobe AIR
    Replies: 4
    Last Post: 3 Nov 2008, 1:57 AM
  5. Multi-Select cell selection model, how to create?
    By DragonFist in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 1 May 2008, 7:28 AM

Posting Permissions

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