1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    14
    Vote Rating
    0
    Answers
    1
    fmuke is on a distinguished road

      0  

    Default Unanswered: how to pass value to an extjs 4 application from an url

    Unanswered: how to pass value to an extjs 4 application from an url


    hi...
    i have develloped an extjs 4 application for reporting purpose.

    To do the work, this application needs to get some value from asp.net application to work.

    i have included the ext js 4 application in part of that asp.net application in a panel trough a an url link

    ... the panel auto load the link inside itself ....

    link has this format :
    <AutoLoadrunat="server"Url="http://localhost:52015/AppNow/App.aspx"/>
    but this url Url=http://localhost:52015/AppNow/App.as...&customerId=01
    do not work.

    i understand that passing this value just like this is not supposed to work anyway... but i havent been able to find any info on this
    ---> below is my app.js... the link is supposed to pass it the customerId along with the year
    Code:
    Core.onPreReady(
    function () {
     
    });
    Core.onReady(
    function () {
    
      
     
    var homeView = "forwarding-kpi-KpiMultiLine";
     
        Core.context.set(
    'yearId', 2011);
        Core.context.set(
    'customerId', '104trrew000,104ret000');
        Core.context.set(
    'customer', 'APPLE COMPUTER, US ARMY');
        Core.context.set(
    'hierarchy', 'Product');
     
        Ext.application({
            name: 
    'AppNow',
            enableQuickTips: 
    true,
            controllers: [
            
    'Home',
    
                    
    
     
            
    'AppNow.view.',
            
    
     
            
    
     
            ],
            launch: 
    function () {
                
    var me = this;
     
                Ext.create(
    'Core.view.portal.Viewport', {
                    homeView: homeView
                });
            }
        });
    });
    

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    436
    Answers
    3113
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    You can send query params and javascript can get the params from the url. Look at the location.search value
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    14
    Vote Rating
    0
    Answers
    1
    fmuke is on a distinguished road

      0  

    Default


    THI IS THE SOLUTION

    Code:
    var urlLink = document.location.href.split('?')[1];
    
    console.log("This is the link ---> " + urlLink);
    
    var linkvar = Ext.Object.fromQueryString(urlLink);
    
    console.log('customerId --> ' + linkvar.customerId);
    console.log('customer  ---> ' + linkvar.customer);
    console.log('yearId    ---> ' + linkvar.yearId);
    console.log('hierarchy ---> ' + linkvar.hierarchy);
    console.log('homeView  ---> ' + linkvar.homeView);
      
    Ext.Object.fromQueryString(foo=1&bar=2); // returns {foo: 1, bar: 2} Ext.Object.fromQueryString(foo=&bar=2); // returns {foo: null, bar: 2} Ext.Object.fromQueryString(some price=%24300); // returns {'some price': '$300'} Ext.Object.fromQueryString(colors=red&colors=green&colors=blue); // returns {colors: ['red', 'green', 'blue']}  Recursive:
      
      Ext.Object.fromQueryString("username=Jacky&dateOfBirth[day]=1&dateOfBirth[month]=2&dateOfBirth[year]=1911&hobbies[0]=coding&hobbies[1]=eating&hobbies[2]=sleeping&hobbies[3][0]=nested&hobbies[3][1]=stuff", true); // returns {     username: 'Jacky',     dateOfBirth: {         day: '1',         month: '2',         year: '1911'     },     hobbies: ['coding', 'eating', 'sleeping', ['nested', 'stuff']] }