Module: Merb::ExtJS::Direct

Defined in:
lib/merb-extjs-direct/mixins/remoting_provider.rb,
lib/merb-extjs-direct.rb

Overview

Meb::ExtJS::Direct::RemotingProvider This is a mixin which provides support Merb support for ExtJS’s Ext.Direct mechanism in Ext3.x <h3>Defining and registering the Ext.Direct api</h3> <code> <script>

var api : {
    url: 'my_controller/rpc',
    type: 'remoting',
    actions: []
};

Ext.onReady(function() {
    // Add some actions from ArtistPart
    api.actions.push({
        ArtistPart : [
            {"name" : "create"},
            {"name" : "destroy"}
        ];
    });
    .
    .
    .
    // add some more actions from AlbumPart
    api.actions.push({
        AlbumPart : [
            {"name" : "create"},
            {"name" : "destroy"}
        ];
    });

    // register api with Ext.Direct
    Ext.Direct.addProvider(api);

    // Executing Ext.Direct actions.  (very much like using irb console)
    ArtistPart.destroy(1);
    AlbumCreate.create({name : "Joe Puke and the Chunky Bits"});

});

</script> </code>

<h3>Configuring your Merb Ext.Direct controller</h3> <code> class MyController

include Merb::Ext::Direct::RemotingProvider   # <-- include this mixin.

end </code>

<p>By including RemotingProvider mixin, your controller will have added to it a single action called “rpc” with which you can send all you Ext.Direct actions to. Take note of the url specified in the first step.</p>

<h3>Merb-parts</h3> Ext.Direct is implemented in Merb by taking advantage of “Parts”. The nice thing about parts is that they have both a view (for rendering you Ext controls and api along with a controller for executing your api actions.

The Merb RemotingProvider mixin takes advantage of the merb-parts gem.

Ext.Direct router

Author:

  • Chris Scott

Defined Under Namespace

Modules: RemotingProvider

Constant Summary collapse

VERSION =
'0.0.4'