1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    sannou is on a distinguished road

      0  

    Default Unanswered: populate a multiselect field using a web service

    Unanswered: populate a multiselect field using a web service


    Hi all.
    im doing a mobile app using sencha touch1 and i want to populate a multiselect field with my RESTFUL web service made by WCF.
    here is my store
    Code:
    Ext.regStore('storeCPT', {
     model: 'compte',
     autoLoad: true,
     proxy: 
     {
     type: 'scripttag',
     url: 'http://localhost:8732/cpts/cltID/1234',
     reader: 
      {
       type: 'json',
      }
     }
    });
    my model:
    Code:
    Ext.regModel('compte', {
        fields: ['compteID']
    });
    and here is my multiselect field puted into my form
    Code:
            {
    		xtype: 'multiselectfield',
                    id: 'cptnumb',
                    label: 'Compte',
    		store        : 'storeCPT',							
                    displayField : "'compteID'",							
                    valueField   : "'compteID'",		
                    name         : "multiselect-picker",
                    itemWidth    : 400,				
                    itemType     : "picker",         
             
            },
    and here is the response of my web service when i try it with my chrome browser
    Code:
    [{"client":null,"clientID":"1234","commercant":null,"commerçantID":null,"compteDATEOUVERTURE":"\/Date(1336086000000+0100)\/","compteDATESOLDE":"\/Date(1338309980940+0100)\/","compteID":"67589","compteSOLDE":17495,"compteTOTALCREDIT":100,"compteTOTALDEBTI":3505,"credits":[],"institution":null,"institutionID":null,"operateur":null,"operateurID":null,"transactions":[],"transferts":[],"virements":[]},{"client":null,"clientID":"1234","commercant":null,"commerçantID":null,"compteDATEOUVERTURE":"\/Date(1336086000000+0100)\/","compteDATESOLDE":"\/Date(1336777200000+0100)\/","compteID":"98765","compteSOLDE":19658,"compteTOTALCREDIT":1000,"compteTOTALDEBTI":1234,"credits":[],"institution":null,"institutionID":null,"operateur":null,"operateurID":null,"transactions":[],"transferts":[],"virements":[]}]
    but it load without displaying any thing.
    can you hel pe please
    thank you

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,073
    Answers
    3500
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You have displayField and valueField set to a string improperly. Notice the double and single quotes you are using:

    Code:
    "'compteID'"
    Should probably just be

    Code:
    "compteID"
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    sannou is on a distinguished road

      0  

    Default


    hi. thank you for your reply.
    i tried as you say "compteID" but it still the same problem, it's load without displaying any thing.
    im using this code to display the multiselectielf with picker as itemtype
    Code:
    Ext.ns("Ext.form.ux.touch");
    
    
    Ext.form.ux.touch.MultiSelect = Ext.extend(Ext.form.Select, {
        columns: 2,
        itemWidth: 200,
        itemType: "list",
        multiSelect: true,
      
        showComponent: function() {
            var me       = this,
                itemType = me.itemType,
                itemPanel;
    
    
            if (itemType === "picker") {
                me.getPicker().show();
            }
            me.isActive = true;
        }, 
    });
    
    
    Ext.reg("multiselectfield", Ext.form.ux.touch.MultiSelect);

    i don't know what kind of modification shall i do?
    thank you

  4. #4
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
    zied jouini is on a distinguished road

      0  

    Default


    SALAM
    try to change
    type: 'scripttag', to type: 'ajax',it should work


  5. #5
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    sannou is on a distinguished road

      0  

    Default


    thank you its works now