Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-1538 in a recent build.
  1. #1
    Ext JS Premium Member
    Join Date
    Jul 2009
    Posts
    239
    Vote Rating
    2
    stephen.friedrich will become famous soon enough

      0  

    Default PR4: Model.load() broken

    PR4: Model.load() broken


    This used to work in PR3 (with the config not wrapped of course):
    Code:
        Ext.define('fitmob.model.Post', {        extend: 'Ext.data.Model',
           config: {
                idProperty: 'path',
                fields: ['path', 'parentUrl', 'pagingEnabled', 'content', 'nav'],
                proxy: {
                    type: 'jsonp',
                    url: 'http://www.fortis-it.de/cms/wp-admin/admin-ajax.php?action=fma_post'
                }
    }
    ...
            Post.load(path, {
                scope: this,
                success: function (post) {
                }
           });
    In PR4 this makes ST log the error "An Operation needs to have a model defined."
    From looking at the sources I found a silly workaround:
    Code:
            Post.load(path, {
                model: Post,
                scope: this,
                success: function (post) {
                }
           });

    ExtJS 4 plugins:
    varheaders - short/normal/long column header
    clearbutton - mouseover clear button in text field
    Blog: fit4dev
    ExtJS User Group Hamburg

  2. #2
    Sencha - Sencha Touch Dev Team Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    21
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    Thank you for the report and test case.

    Sencha Inc

    Jamie Avins

    @jamieavins

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    86
    Vote Rating
    4
    karazy is on a distinguished road

      0  

    Default


    Thx for the workaround. I got the same error and my first thought was on having a wrong configuration.
    But after I went with your workaround I'm seeing another error.

    Uncaught TypeError: Cannot call method 'getId' of undefined

    This error occurs in buildUrl method. The record object is undefined!

    Code:
          
     buildUrl: function(request) {        var me        = this,
                operation = request.getOperation(),
                records   = operation.getRecords() || [],
                record    = records[0],
                format    = me.getFormat(),
                url       = me.getUrl(request),
                // @TODO: put back the operation id
                //id        = record ? record.getId() : operation.id,
    
                id        = record.getId();



  4. #4
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Thanks for the report. This will be fixed in the beta.

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    46
    Vote Rating
    1
    gubarez is on a distinguished road

      0  

    Default


    Something similar happens with store. I need to set the model when setting new proxy to a memory store, even though it has been set in the store config property. This happened after migrating from PR3 to PR4

    Code:
    myStore.setProxy({
                type:'memory',
            model: 'MyModel',
                data: quests,
                reader: {
                    type: 'json',
                    rootProperty: 'items'
                }
            });

  6. #6
    Sencha User
    Join Date
    Apr 2011
    Posts
    212
    Vote Rating
    3
    bweiler is on a distinguished road

      0  

    Default Same problem with operation in PR4

    Same problem with operation in PR4


    I ran into the same problem using operations.

    Code:
    		// Setup the read operation
    		operation = new Ext.data.Operation({
    			model: model, // ST4 code or documentation bug
    			action: 'read'
    		});
    The model property was not required in PR3.

  7. #7
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Code:
            Post.load(path, {
                scope: this,
                success: function (post) {
                }
           });
    This has been fixed and will be part of the Beta.

    Code:
    myStore.setProxy({
                type:'memory',
            model: 'MyModel',
                data: quests,
                reader: {
                    type: 'json',
                    rootProperty: 'items'
                }
            });
    This has also been made so you don't need to set the model in the config passed to setProxy().

    In the case where you define an operation yourself manually, we require you to specify the Model that the operation is going to be handling. In the refactored data package, Operations take care of handling any type of response (update, destroy, read, create). In order to do this, they need to know which Model they are dealing with. I have updated the documentation to explain this.