Generic Plugin Examples

Page 1 of 2 12 LastLast
  1. #1

    Generic Plugin Examples

    Does anyone have any examples of getting a generic plugin working?
  2. #2

    RE: Generic Plugin Examples

    I am taking the following plugin I found on ext js site and using it in my panel as a generic plugin but keep getting an "object expected error"

    here is the config for the panel
    
    
    
    <ext:Panel ID="Panel1" runat="server" Title="Main Menu" Height="100" BodyStyle="padding:6px;border-width: 1px;"
    
    
    Collapsed="True">
    
    
    <Body>
    
    
    <ext:Label ID="lblTest" runat="server">
    
    
    </ext:Label>
    
    
    </Body>
    
    
    <Plugins>
    
    
    <ext:GenericPlugin ID="GenericPlugin1" runat="server" InstanceOf="Ext.ux.CollapsedPanelTitlePlugin">
    
    
    <CustomConfig>
    
    
    <ext:ConfigItem Name="expandOnClick" Value="true" />
    
    
    </CustomConfig>
    
    
    </ext:GenericPlugin>
    
    
    </Plugins>
    
    
    </ext:Panel>
    here is the plugin code:
    
    
    
    Ext.namespace("Ext.ux");
    
    
    Ext.ux.CollapsedPanelTitlePlugin = function(expandOnClick) {
    
    
    this.expandOnClick = (!expandOnClick ? expandOnClick : true);
    
    
    };
    
    
    Ext.ux.CollapsedPanelTitlePlugin.prototype = {/** @scope Ext.ux.CollapsedPanelTitlePlugin.prototype */
    
    
    init: function(p) {
    
    
    if (p.collapsible) {
    
    
    var r = p.region;
    
    
    p.on("render", function() {
    
    
    var ct = p.ownerCt;
    
    
    ct.on("afterlayout", function() {
    
    
    if (ct.layout[r].collapsedEl) {
    
    
    if (this.expandOnClick) {
    
    
    ct.layout[r].collapsedEl.on("click", p.expand, p);
    
    
    ct.layout[r].collapsedEl.setStyle("cursor", "pointer");
    
    
    }
    
    
    this.createChild(p);
    
    
    }
    
    
    }, this, { single: true });
    
    
    p.on("collapse", function() {
    
    
    if (ct.layout[r].collapsedEl &amp;&amp; !p.collapsedTitleEl) {
    
    
    this.createChild(p);
    
    
    }
    
    
    }, this, { single: true });
    
    
    }, this);
    
    
    }
    
    
    },
    
    
    createChild: function(p) {
    
    
    var r = p.region;
    
    
    var ct = p.ownerCt;
    
    
    var title = (p.collapsedTitle ? p.collapsedTitle : p.title);
    
    
    var html = "";
    
    
    if (r == "east" || r == "west") {
    
    
    html += "<ul class=\"vertical\"><li>";
    
    
    var titleSplit = title.split("");
    
    
    for (var i = 0; i < titleSplit.length; i++) {
    
    
    if (titleSplit[i] == " ")
    
    
    titleSplit[i] = " ";
    
    
    html += "<em>" + titleSplit[i] + "</em>";
    
    
    }
    
    
    html += "</li></ul>";
    
    
    } else {
    
    
    html = title;
    
    
    }
    
    
    /* var leftPadding = (p.collapsedIcon ? 24 : 4);
    
    
    var background = (p.collapsedIcon ? "url('" + p.collapsedIcon + "') no-repeat left center;" : "transparent;");
    
    
    var style = "padding-left:" + leftPadding + "px; margin-left:4px; margin-top:2px; background:" + background;
    
    
    */
    
    
    p.collapsedTitleEl = ct.layout[r].collapsedEl.createChild({
    
    
    tag: "div",
    
    
    //style :style,
    
    
    //cls :"x-panel-collapsed-text",
    
    
    html: html
    
    
    });
    
    
    }
    
    
    };
  3. #3

    RE: Generic Plugin Examples

    OK - by putting on my path reference - it started to work
  4. #4

    RE: Generic Plugin Examples

    However - I cannot, for the life of me - get it to accept :

    
    
    
    <CustomConfig>
    
    
    <ext:ConfigItem Name="collapsedTitle" Value="false" />
    
    
    </CustomConfig>
  5. #5

    RE: Generic Plugin Examples

    Hi Tbaseflug,

    I'm not really sure what that Plugin should be doing, but when I add in the <ext:GenericPlugin> control and the <CustomConfig>, the script that gets rendered appears to be correct. This is what I get for the Plugin constructor.


    Example


    plugins: new Ext.ux.CollapsedPanelTitlePlugin({expandOnClick:true})

    Geoffrey McGill
    Founder
  6. #6

    RE: Generic Plugin Examples

    Here's the tag structure I was using...

    <ext:Panel 
        ID="Panel1" 
        runat="server" 
        Title="Main Menu" 
        Height="100" 
        BodyStyle="padding:6px;border-width: 1px;"
        Collapsed="True">
        <Body>
            <ext:Label ID="lblTest" runat="server" />
        </Body>
        <Plugins>
            <ext:GenericPlugin ID="GenericPlugin1" runat="server" InstanceOf="Ext.ux.CollapsedPanelTitlePlugin">
                <CustomConfig>
                    <ext:ConfigItem Name="expandOnClick" Value="true" />
                </CustomConfig>
            </ext:GenericPlugin>
        </Plugins>
    </ext:Panel>
    Geoffrey McGill
    Founder
  7. #7

    RE: Generic Plugin Examples




    The plugin set the collapsed text for a panel in a viewport - works great - I can see that the plugin accepts a few params and so was trying to pass them in via the CustomConfig tags but no matter what I put in, it has no affect - positive or negative
  8. #8

    RE: Generic Plugin Examples

    I think there's an issue with passing the single boolean param. As a plugin it should accept a single 'config object' parameter. I have not tested the following code, but I think it should work if the constructor was changed to the following.

    Example

    // Old
    Ext.ux.CollapsedPanelTitlePlugin = function(expandOnClick) {
        this.expandOnClick = (!expandOnClick ? expandOnClick: true);
    };
    
    // New
    Ext.ux.CollapsedPanelTitlePlugin = function(config) {
        Ext.apply(this, config);
    };
    Hope this helps.

    Geoffrey McGill
    Founder
  9. #9

    RE: Generic Plugin Examples

    The following Example may also be of interest to you, see https://examples1.ext.net/#/Layout/B..._Region_Image/

    Hope this helps.

    Geoffrey McGill
    Founder
  10. #10

    RE: Generic Plugin Examples

    Thanks - was getting around the image use - I hard-coded the JS of the plugin to accept my values needed - don't suppose anyone can show me how to take a plugin like this and make it work with a coolite GridPanel...?

    http://www.jadacosta.es/extjs/exampl...derPlugin.html
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] TabBar Config examples in Examples Explorer not working
    By anup in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 26, 2012, 9:32 AM
  2. Replies: 7
    Last Post: Mar 22, 2012, 1:00 PM
  3. [CLOSED] [1.0] Generic plugin not rendering
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 11, 2009, 8:06 AM
  4. 1.0 generic plugin
    By [WP]joju in forum 1.x Help
    Replies: 7
    Last Post: Dec 07, 2009, 12:37 PM
  5. generic plugin parameter
    By [WP]joju in forum 1.x Help
    Replies: 3
    Last Post: Nov 20, 2008, 7:35 AM

Posting Permissions