1. #1
    Sencha Premium Member
    Join Date
    Apr 2010
    Posts
    7
    Vote Rating
    0
    Izvr is on a distinguished road

      0  

    Default Problem with DirectStore

    Problem with DirectStore


    Hello.
    I am trying to use Direct b DirectStore in my application, but I have some problems with them.

    I write in MVC style and add in my app.js file this:
    Code:
                    Ext.direct.Manager.addProvider({
                        'type': 'remoting',
                        'url': '/places/remoting/router/',
                        'namespace': 'Recruitant.places',
    
    
                        'actions': {
                            'city': [
                                {
                                    'formHandler': false,
                                    'name': 'load_cities',
                                    'len': 1
                                }
                            ]
                        }
                    });
                    Recruitant.places.city.load_cities();
    This code work fine, but I try to define Model like this:
    Code:
    Ext.define('Recruitant.model.City', {
        extend: 'Ext.data.Model',
    
    
        proxy: {
            type: 'direct',
            url: '/places/remoting/router/',
            directFn: 'Recruitant.places.city.load_cities'
        },
    
    
        fields: [
            {name: 'id', type: 'int'},
            {name: 'name', type: 'string'}
        ]
    });
    and DirectStore like this:
    Code:
    Ext.define('Recruitant.store.Cities', {
        extend: 'Ext.data.DirectStore',
        model: 'Recruitant.model.City'
    
    
    });
    and in my firebug have error "fn is undefined".

    Help me to solve this problem, please.

  2. #2
    Sencha Premium Member
    Join Date
    Apr 2010
    Posts
    7
    Vote Rating
    0
    Izvr is on a distinguished road

      0  

    Default


    My code works if I create grid, store and other objects in app.js, but it is not work if I write Store, Model and other stuff with Ext.define.

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    13
    Vote Rating
    0
    oniseijin is on a distinguished road

      0  

    Default


    On the client side, remove the quotes around the directFn specification: it needs to be a function, not a strong.


    You have:
    directFn: 'Recruitant.places.city.load_cities'

    You should have:
    directFn: Recruitant.places.city.load_cities

  4. #4
    Sencha Premium Member
    Join Date
    Apr 2008
    Posts
    262
    Vote Rating
    26
    themightychris will become famous soon enough themightychris will become famous soon enough

      0  

    Default


    @oniseijin - not true, docs say: "The directFn may also be a string reference to the fully qualified name of the function, for example: 'MyApp.company.GetProfile'. This can be useful when using dynamic loading. The string will be looked up when the proxy is created."

    I am using it as a string in my application now and it is necessary in case the JS gets loaded out of order, although I have gotten intermittent errors about the directFn is null whether I use the string or function symbol format
    Chief Architect @ Jarv.us Innovations
    Co-captain @ Code for Philly

    Jarvus builds and optimizes top-quality Sencha Touch and ExtJS apps for open-source projects and clients of all sizes.

    Don't waste time with bugs that have already been found and fixed by the community, compile our tried and tested hotfixes packages into all your projects: https://github.com/JarvusInnovations/sencha-hotfixes

Thread Participants: 2

Tags for this Thread