Results 1 to 2 of 2

Thread: strange behavior of ajax call or store load

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Jun 2011
    Vote Rating

    Exclamation Unanswered: strange behavior of ajax call or store load

    hi everyone,
    I am implementing one page contain 3 tabs.on each tab i am calling different views (on click of each tab by dispatch) via controller's method . here i am creating different store in each view but model and JSON is same.
    if i switch between 3 tabs then on 3rd or 4th click AJAX call to json are getting doubled. like instead of making one JSON request it is making more than one request automatically increases that count if i go for next tab click. but i am getting data correct. Why it is making 3-4 ajax calls extra . as i'm calling three views and creating store new.
    following is rough structure of my code
    myController = new Ext.Controller({
    //call view
    //call view
    //call view


    view file

    myview=Ext.extend(Ext.Panel, {

    // docked items
    // three tabs or items of segmented button toolbar
    items: [{ text: 'tab1',
    }, {
    text: 'tab2',
    text: 'tab3',

    listeners: {
    toggle: this.onSwitch
    scope: this

    //some build items method that will create store and load data from json

    onSwitch:function(segButton, button, pressed){

    Ext.dispatch({ controller: myController,
    action: 'method1'
    /*similarly for other 2 tabs*/


    now first user will come at t1 tab when we try to switch from t1->t2 ,t2->t3 and t3->t1 now on last click it is making request twice to same json. again if user switch to other tab it doubles (count is not finite) request to json.
    don't know what is happening?where i am doing wrong?
    please help me......!!!!!!!!!!!!!!!!!!!
    Thanks in advance

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    You should not have arrays and objects as a property or else they are in danger of being shared among all instances of that class. Instead, you need to build a new array and object within a method that is fired when a new instance is created like the initComponent method.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2

    Think my support is good? Get more personalized support via a support subscription.

    Need more help with your app? Hire Sencha Services

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts