1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    4
    Vote Rating
    0
    mr.khan is on a distinguished road

      0  

    Default Unable to load data value in simplestore dynamically

    Unable to load data value in simplestore dynamically


    Hi All,

    I am fairly new to ExtJS.
    I am trying to load my combo box on depending upon selected value from the previous combo box. (Same Old Country-state scenario) i am making an ajax call and getting values too and assigning in 'data' but it is showing just 2nd character of my variable.


    Code:
    attributeStore = new Ext.data.SimpleStore({
            fields: ['idc','criteria'],
            data  : [ sb ]
    });
    
    var tempcriteria = Ext.getCmp('criteriaId');
    tempcriteria.bindStore( attributeStore );
    from ajax's call I am assigning
    Code:
    sb = ['CITY_NAME','CITY_NAME'],['CNTRY_NAME','CNTRY_NAME'],['STATUS','STATUS']
    But all I am getting is ' <single inverted comma>. Since its the 2nd character in sb.
    I tried changing data to

    Code:
    data : ['sb']
    My combo box is filled with 'b'

    Its bit weird thing happening. I even tried
    Code:
    data : [['CITY_NAME','CITY_NAME'],['CNTRY_NAME','CNTRY_NAME'],['STATUS','STATUS']]
    which works smoothly.
    I am assuming I am making a silly mistake somewhere.
    Appreciate any help.

    Regards,
    M. Rizwan Khan

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,188
    Vote Rating
    119
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Quote Originally Posted by mr.khan View Post
    I even tried
    Code:
    data : [['CITY_NAME','CITY_NAME'],['CNTRY_NAME','CNTRY_NAME'],['STATUS','STATUS']]
    which works smoothly.
    An array of arrays is the correct format you should be returning
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    4
    Vote Rating
    0
    mr.khan is on a distinguished road

      0  

    Default


    Hi Aconran,

    Thanks for quick response.
    Yeah this works

    data : [['CITY_NAME','CITY_NAME'],['CNTRY_NAME','CNTRY_NAME'],['STATUS','STATUS']]but when assigning
    sb = ['CITY_NAME','CITY_NAME'],['CNTRY_NAME','CNTRY_NAME'],['STATUS','STATUS']
    at runtime and then giving

    attributeStore = new Ext.data.SimpleStore({
    fields: ['idc','criteria'],
    data : [ sb ]
    });

    it is just displaying ' <single inverted comma> in combobox.

    Regards,
    M. Rizwan Khan

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,188
    Vote Rating
    119
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Try
    Code:
    sb = [['CITY_NAME','CITY_NAME'],['CNTRY_NAME','CNTRY_NAME'],['STATUS','STATUS']];
    
    attributeStore = new Ext.data.SimpleStore({
            fields: ['idc','criteria'],
            data  : sb
    });
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    4
    Vote Rating
    0
    mr.khan is on a distinguished road

      0  

    Default


    Yeah, what you suggested worked.
    But when assign the my String to 'sb' it doesnt work.
    I understood the problem is I am giving a String to 'data' whereas it is expecting array of array.

    Thanks Acronran. I'll now have to convert my String (
    [['CITY_NAME','CITY_NAME'],['CNTRY_NAME','CNTRY_NAME'],['STATUS','STATUS']])

    to array of array, Don't wanna be a burden but any idea how to do that ?

    Regards,
    M. Rizwan Khan

  6. #6
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,188
    Vote Rating
    119
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    an unsafe way would be to simply eval it.

    A safer way would be to stick it into a JSON object, decode it and then use that.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  7. #7
    Sencha User
    Join Date
    Apr 2012
    Posts
    4
    Vote Rating
    0
    mr.khan is on a distinguished road

      0  

    Default


    Thanks a lot aconran. Gone with the unsafe way and its working now.

    Cheers,
    M. Rizwan Khan

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