1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    9
    Vote Rating
    1
    nohsib is on a distinguished road

      0  

    Default Unanswered: How to call custom api which is specified in the proxy in the model

    Unanswered: How to call custom api which is specified in the proxy in the model


    Hi,
    My model has a proxy like this :

    Code:
            proxy:
            {
                type: 'rest',
                url: '<service>',
                api:{
                    read:'<read_service>',
                    update:'<update_service>',
                    create:'<create_service>'
                },
                reader:
                {
                    type: 'json',
                    root: 'List.elements.collection'
                },
                writer: {
                type: 'json',
                nameProperty: 'mapping',
                root: 'VO'
                }
            }
    When I call save on the model, based on the idProperty, the model decides to call the create (idProperty=0)or update(idProperty!=0). Now if I have new services like Enable and Disable, as below. Then how do I call/invoke the enable and/or disable service.

    Code:
    proxy:
            {
                type: 'rest',
                url: '<service>',
                api:{
                    read:'<read_service>',
                    update:'<update_service>',
                    create:'<create_service>',
                                    enable:'<enable_service>',
                                    disable:'<enable_service>'
                },
                reader:
                {
                    type: 'json',
                    root: 'List.elements.collection'
                },
                writer: {
                type: 'json',
                nameProperty: 'mapping',
                root: 'VO'
                }
            }

    thanks
    Nohsib

  2. #2
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Vote Rating
    27
    Answers
    106
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    It would be a lot simpler just to treat an enable/disable as an 'update'. After all, you're basically updating the 'status' of an item. Otherwise, you're going to have to do a whole lot of extending/overriding...

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    9
    Vote Rating
    1
    nohsib is on a distinguished road

      0  

    Default


    Thanks friend. But on the server side enable and disable are exposed as separate services as there are more operations associated than just enable /disable.

Thread Participants: 1