Skip to content

Allows to add any url to model and use it as model action - same as default crud operations

License

Notifications You must be signed in to change notification settings

pavel-kurnosov/extjs-any-action-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

extjs-any-action-proxy

Allows to add any action to model and use it as model action - same as default crud operations

Usage:

  1. Add files to your app.js;
  2. Create model with new rest:
Ext.define('app.model.Folder', {
    extend: 'Ext.data.Model',
    proxy: {
        type: 'phrest', // our new rest proxy
        url: 'rooms/{roomId}/documents/folder',
        
        // action that we add
        actionMethods: {
            'flagThisFolder': 'PUT'
        },

        // url for action
        api: {
            flagThisFolder: 'rooms/{roomId}/documents/folder/{nodeId}/markThisFolder'
        }
    },
    
    // usage of action
    markFolder: function (callback) {
        var options = {};
        options.customAction = 'flagThisFolder';
        options.callback = callback;
        this.doPost(options);
    },
});
  1. Use in your code:
Ext.create('app.model.Folder').markFolder({success: function(){console.log('done');}});

About

Allows to add any url to model and use it as model action - same as default crud operations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published