1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    4
    Vote Rating
    0
    akarsh478 is on a distinguished road

      0  

    Default Easiest way to show suggestion list from store values.

    Easiest way to show suggestion list from store values.


    Hello everyone,

    I am a sencha beginner and need help from all those sencha gurus out there. I have a store with names / email ids in it. When the user starts typing a name in a text field(probably To: cc: or Bcc: ) i need to show a list of filtered suggestions below it. If one of the list item is selected, that has to be added to the text field. I have tried it,but it has many problems. Can anyone suggest me a easy and efficient way to do this?
    Last edited by akarsh478; 10 Jul 2012 at 10:21 PM. Reason: smiley edit

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      1  

    Default


    Hi,
    If you want that your text field should give suggestion when user type, you can use the combobox in place of textfield. I have defined two ways so that It will not look like a combobox:

    1. In this case combo will look like a search field, review the following code:
    Code:
    // The data store containing the list of states
    var states = Ext.create('Ext.data.Store', {
        fields: ['abbr', 'name'],
        data : [
            {"abbr":"AL", "name":"Alabama"},
            {"abbr":"AK", "name":"Alaska"},
            {"abbr":"AZ", "name":"Arizona"}
            //...
        ]
    });
    
    // Create the combo box, attached to the states data store
    Ext.create('Ext.form.ComboBox', {
        fieldLabel: 'Choose State',
        typeAhead: true,
        store: states,
        triggerCls: 'x-form-search-trigger',  // for the first case
    //    triggerCls: 'combo-no-icon-cls',  // for the second case
        queryMode: 'local',
        displayField: 'name',
        valueField: 'abbr',
        renderTo: Ext.getBody()
    });
    2. In this scenario you just need to change the 'triggerCls' config of the combobox. I have defined a class in css section given below. Just set the below class 'combo-no-icon-cls' to the 'triggerCls' config of the combobox:
    HTML Code:
    .combo-no-icon-cls{background:none;width:0px;border-bottom:none;}
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    4
    Vote Rating
    0
    akarsh478 is on a distinguished road

      0  

    Default


    Thanks a lot for the quick reply. This makes a very good starting point for building my suggestion box.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi