Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Jul 2008
    Location
    Czech republic
    Posts
    49
    Vote Rating
    0
    ondra.cz is on a distinguished road

      0  

    Default Unanswered: Extension of Ext.data.Model

    Unanswered: Extension of Ext.data.Model


    Hello,
    I would like to extends Ext.data.Model class and than use this new extended class to create models. I'd like to do something like this:

    Code:
    Ext.define('Ext.ux.data.Model', {
        extend : 'Ext.data.Model',
    
        constructor : function() {
            Ext.applyIf(this.proxy, {
                type : 'ajax',
                actionMethods : {
                    read : 'POST',
                    create : 'POST',
                    update : 'POST',
                    destroy : 'POST'
                },
                reader : {
                    type : 'json',
                    root : 'data',
                    successProperty : 'success',
                    totalProperty : 'total',
                    messageProperty : 'message'
                },
                writer : {
                    type : 'json',
                    encode : true,
                    writeAllFields : false,
                    root : 'data',
                    allowSingle : false
                }
            });
    
            this.callParent(arguments);
        }
    
    });
    Code:
    Ext.define('Module.admin.model.User', {
        extend : 'Ext.ux.data.Model',
    
        fields : [{
                name : 'userId',
                type : 'int'
            }, {
                name : 'roleId',
                type : 'int'
            }, {
                name : 'firstName',
                type : 'string'
            }, {
                name : 'lastName',
                type : 'string'
            }, {
                name : 'mail',
                type : 'string'
        }],
    
        idProperty : 'userId',
    
        proxy : {
            api : {
                create : '/admin/user/create',
                read : '/admin/user/read',
                update : '/admin/user/update',
                destroy : '/admin/user/destroy'
            }
        }
    });
    This method works for me for stores, but for models it doesn't. It tries to call script on /proxy/undefined.js for unknow reason and than throws error, because this script doesn't exists.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,519
    Answers
    3447
    Vote Rating
    814
    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


    Look at the source for Ext.data.Model and notice the onClassExtended method it uses. You should hook into it instead of the constructor.
    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
    Jul 2008
    Location
    Czech republic
    Posts
    49
    Vote Rating
    0
    ondra.cz is on a distinguished road

      0  

    Default


    Thank you for answer.
    I tried to override the onClassExtended function, but I didn't find a way how to call the superclass method.

    Code:
    this.callParent(arguments)
    throws method.$owner is undefined

    Code:
    this.superclass.onClassExtended.apply(this, arguments)
    throws this.superclass.onClassExtended is undefined.

    Can you help me to solve it?

  4. #4
    Sencha User
    Join Date
    Jul 2008
    Location
    Czech republic
    Posts
    49
    Vote Rating
    0
    ondra.cz is on a distinguished road

      0  

    Default Bug found

    Bug found


    I'm not realy sure, where is the problem, but when I define proxy.type = 'ajax' in User model, everything works fine.
    Code:
    Ext.define('Module.admin.model.User', {
        extend : 'Ext.ux.data.Model',
    ...
        proxy : {
            type : 'ajax',
            api : {
                create : '/core/user/create',
                read : '/core/user/read',
                update : '/core/user/update',
                destroy : '/core/user/destroy'
            }
        },
    ...
    });
    When type is not defined, I can see request like this in firebug
    GET http://www.example.com/proxy/undefined.js?_dc=123456789
    for unknown reason.

  5. #5
    Sencha User
    Join Date
    Jul 2008
    Location
    Czech republic
    Posts
    49
    Vote Rating
    0
    ondra.cz is on a distinguished road

      0  

    Default


    Ok, it is because "type" is mandatory attribute. But the extension with overriden constructor still doesn't work at all.

Thread Participants: 1