1. #1
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    118
    Answers
    8
    Vote Rating
    2
    vnggui is on a distinguished road

      0  

    Question Answered: convert function in model

    Answered: convert function in model


    I want to customize response data, insert port number to an URL string;

    In model define like:

    HTML Code:
    config: {
                 fields: [
                        {name:'nid', mapping:'ID'},
                        {name:'title', mapping:'title'},
                        {name:'imgurl',
                          mapping:'imgURL',                          
                          type:'string',
                          convert:function(v,rec){
                                var imgurlWithPort = imgurl.replace(/10.148.148.25/g,"10.148.148.25:8080")
                                return imgurlWithPort;
                          }
                        }
                    ]
        }
    error as 'imgurl undefined'.
    So how can customize mapping data (say, inserting a port number to URL string) using convert function?

    thanks

    gui

  2. post solution for those who have same concern:
    Assuming I have a property named 'imageUrlFromResponse' in response, like 'ID' and 'title', I can convert it like:
    HTML Code:
    config: {              fields: [                     {name:'nid', mapping:'ID'},                     {name:'title', mapping:'title'},                     {name:'imgurl',                                                 type:'string',                       convert:function(v,rec){
                                var imageUrl = rec.raw.imageUrlFromResponse;                             var imgurlWithPort = imageUrl.replace(/10.148.148.25/g,"10.148.148.25:8080")                             return imgurlWithPort;                       }                     }                 ]     }

  3. #2
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    118
    Answers
    8
    Vote Rating
    2
    vnggui is on a distinguished road

      0  

    Default


    post solution for those who have same concern:
    Assuming I have a property named 'imageUrlFromResponse' in response, like 'ID' and 'title', I can convert it like:
    HTML Code:
    config: {              fields: [                     {name:'nid', mapping:'ID'},                     {name:'title', mapping:'title'},                     {name:'imgurl',                                                 type:'string',                       convert:function(v,rec){
                                var imageUrl = rec.raw.imageUrlFromResponse;                             var imgurlWithPort = imageUrl.replace(/10.148.148.25/g,"10.148.148.25:8080")                             return imgurlWithPort;                       }                     }                 ]     }

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