1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    7
    Vote Rating
    0
    akshay_prabhu is on a distinguished road

      0  

    Default Ext.dispatch error

    Ext.dispatch error


    Hello,

    I am using Sencha Touch MVC pattern and trying to redirect from one view to other using Ext.dispatch.

    The code for same is
    Ext.dispatch({
    controller : 'networkcntrlr',
    action : 'showProfileDetails'
    });

    I have written this on button handler, but it is giving me error "This method requires container property to be set."

    I am stuck on this error for a long time and not able resolve it.
    Any suggestions would be appreciated.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,650
    Vote Rating
    899
    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


    There is a valid controller named 'networkcntrlr' with action 'showProfileDetails'. Does that action get fired? Have you set a breakpoint to follow the Ext.dispatch call to see where it breaks?
    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
    Jun 2011
    Posts
    7
    Vote Rating
    0
    akshay_prabhu is on a distinguished road

      0  

    Default


    The method showProfileDetails is getting fired.
    But the redirection is not happening.
    It is giving the error as
    "Uncaught TypeError: Cannot read property 'layout' of undefined "

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,650
    Vote Rating
    899
    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


    Ok.... so what's in that method that is undefined?
    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.

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    7
    Vote Rating
    0
    akshay_prabhu is on a distinguished road

      0  

    Default


    This is the error it is giving
    TypeError: Result of expression 'config' [undefined] is not an object.
    config is undefined.

    The code for showProfileDetails function is

    showProfileDetails: function (options) {

    console.log('SHOW PROFILE DETAILS'); //This statement is getting printed in the Log.


    if (!Ext.isDefined(options.container)) {
    Ext.Msg.alert("Error", "This method required the container property to be set.");
    return;
    }
    if (!Ext.isDefined(options.shopSeqId)) {
    Ext.Msg.alert("Error", "This method required the shopSeqId property to be set.");
    return;
    }

    var container = options.container;

    var config = {};
    console.log('shopSeqId:' + options.shopSeqId);
    config.shopSeqId = options.shopSeqId;
    config.screenCode = options.screenCode;
    config.backButtonText = "NETWORK";
    config.previousView = container.getActiveItem();

    switch (options.screenCode) {
    case 'PROFILE_INFO':
    case 'PROFILE_ACTIVITY':
    config.firstTab = options.screenCode;
    break;
    default:
    config.firstTab = "PROFILE_INFO";
    break;
    }

    var screen = new mye01.views.ProfileDetails(config);

    var store = Ext.StoreMgr.get("networkShopDetailsStore");

    store.load({
    params: {
    shopSeqId: options.shopSeqId
    },
    callback: function (records, operation, success) {
    if (success && records.length > 0) {

    for (j = 0; j < records.length; j++) {
    if (records[j].data.shopSeqId == options.shopSeqId) {
    console.log("rec.....");
    console.log(records[j].data.shopSeqId);
    console.log("seqId...");
    console.log(options.shopSeqId);
    screen.updateWithRecord(records[j]);
    container.setActiveItem(screen, {
    type: 'slide',
    direction: 'left'
    });
    container.setLoading(true);
    }
    }
    }
    container.setLoading(false);
    }
    });

    }









Thread Participants: 1