Results 1 to 10 of 10

Thread: SA4 Bug when adding update event to a Store

    Success! Looks like we've fixed this one. According to our records the fix was applied for DSGNR-7212 in Architect 4.0.1.
  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    2

    Default SA4 Bug when adding update event to a Store

    Hi noticed this when adding an update event handler via the Basic Event Bindings in Architect 4.0.

    When I do this architect generates this code:

    Code:
    listeners: {
        update: {
          fn: me.onStoreUpdate,
          scope: me
        }
      }
    ,
    
    
      onStoreUpdate: function(store, record, operation, modifiedFieldNames, details, eOpts) {
    
    
      },
    And after compiling and trying out the app, the browser will choke on the reference to me.

  2. #2

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha Premium User
    Join Date
    Jan 2014
    Location
    Italy
    Posts
    116

    Default

    Same problem on my apps

    Please fix ASAP.

  4. #4
    Sencha Premium User
    Join Date
    Jan 2014
    Location
    Italy
    Posts
    116

    Default

    The issue still exist if the store is not "global" but tied to specific view.

  5. #5
    Sencha User
    Join Date
    Sep 2014
    Location
    Central Europe
    Posts
    795

    Default

    Quote Originally Posted by faireu View Post
    The issue still exist if the store is not "global" but tied to specific view.
    Could you be please more specific ? Share some code?

    You mean when using store in ViewModel ? I can't see any problem when adding ViewController event binding (listener) to the store in ViewModel.

  6. #6
    Sencha Premium User
    Join Date
    Jan 2014
    Location
    Italy
    Posts
    116

    Default

    Sorry, I got this error on a 3.5 project converted to 4.0 but I'm unable to reproduce the error on new projects.

    Forget my post.

    Thanks

  7. #7
    Sencha User
    Join Date
    Sep 2014
    Location
    Central Europe
    Posts
    795

    Default

    Quote Originally Posted by faireu View Post
    Sorry, I got this error on a 3.5 project converted to 4.0 but I'm unable to reproduce the error on new projects.

    Forget my post.

    Thanks
    I see. If the issue still persists. Try to remove / add the listener again. If it doesn't work, try to duplicate whole class in project inspector. This should regenerate the code.

  8. #8
    Sencha Premium User EricRicher's Avatar
    Join Date
    Jul 2014
    Posts
    45

    Default

    I have the same issue. Here's the code generated by SA when I add a listener for a "load' event to the UserStore store in a ViewModel.

    I am new to using SA 4 with ViewModel and ViewController. Maybe I am not doing it properly but I want to listen the load event on the UserStore. Eventually, my MainTabPanelViewModel will have multiple stores and I will add listeners to each store.

    SA adds me in front of the onStoreLoad function in the listener config. When loading in the browser, me is not defined and an exception is thrown.


    Ext.define('Myapp.view.MainTabPanelViewModel', {
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.maintabpanel',


    requires: [
    'Ext.data.Store',
    'Ext.data.proxy.Ajax',
    'Ext.data.reader.Json'
    ],


    stores: {
    UserStore: {
    model: 'Myapp.model.User',
    clearOnPageLoad: false,
    proxy: {
    type: 'ajax',
    url: '/e/me',
    reader: {
    type: 'json'
    }
    },
    listeners: {
    load: {
    fn: me.onStoreLoad
    }
    }
    }
    },


    onStoreLoad: function(store, records, successful, operation, eOpts) {
    console.log('UserStore data loaded');
    },


    });

  9. #9
    Sencha Premium User EricRicher's Avatar
    Join Date
    Jul 2014
    Posts
    45

    Default

    My mistake.

    I should have created a ViewController event instead an event on the store within the ViewModel.






    Quote Originally Posted by EricRicher View Post
    I have the same issue. Here's the code generated by SA when I add a listener for a "load' event to the UserStore store in a ViewModel.

    I am new to using SA 4 with ViewModel and ViewController. Maybe I am not doing it properly but I want to listen the load event on the UserStore. Eventually, my MainTabPanelViewModel will have multiple stores and I will add listeners to each store.

    SA adds me in front of the onStoreLoad function in the listener config. When loading in the browser, me is not defined and an exception is thrown.


    Ext.define('Myapp.view.MainTabPanelViewModel', {
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.maintabpanel',


    requires: [
    'Ext.data.Store',
    'Ext.data.proxy.Ajax',
    'Ext.data.reader.Json'
    ],


    stores: {
    UserStore: {
    model: 'Myapp.model.User',
    clearOnPageLoad: false,
    proxy: {
    type: 'ajax',
    url: '/e/me',
    reader: {
    type: 'json'
    }
    },
    listeners: {
    load: {
    fn: me.onStoreLoad
    }
    }
    }
    },


    onStoreLoad: function(store, records, successful, operation, eOpts) {
    console.log('UserStore data loaded');
    },


    });

  10. #10
    Sencha Premium User
    Join Date
    Oct 2012
    Location
    United States
    Posts
    130

    Default

    Quote Originally Posted by EricRicher View Post
    My mistake.

    I should have created a ViewController event instead an event on the store within the ViewModel.

    you could also create a function and manually define the listener.

Similar Threads

  1. 4.2.1 Ext.data.Store update event
    By fdp in forum Ext: Q&A
    Replies: 4
    Last Post: 12 Jun 2013, 12:35 AM
  2. Problem with Store's Update event
    By varunjyoti in forum Ext: Q&A
    Replies: 4
    Last Post: 16 Jul 2012, 6:41 AM
  3. Adding record to store does not update TotalCount
    By Spenna in forum Ext 3.x: Help & Discussion
    Replies: 12
    Last Post: 29 Jul 2011, 4:33 AM
  4. [CANCELD] In Store - how call remove event from update event
    By nitingautam in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 22 Jan 2009, 2:51 PM

Posting Permissions

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