How to set renderer in code behind for RowExpander plugin?

  1. #1

    How to set renderer in code behind for RowExpander plugin?

    I'm using ext.net 1.7 and extjs 3.4 for this project. Not upgraded yet because it will be a massive work to be done since it was developer years ago.

    In my C# class, how can I set renderer as I want to hide the expander based on conditions?

    C#
    var re = new RowExpander
    	        {
                    ID = "RulesRowExpander",
    	            Width = 50,
                    Listeners =
                    {                    
                        Expand =
                        {
                            Handler = "#{" + ID + "}.rowExpanderOnExpandListener(record.id);"
                        },
                        BeforeExpand =
                        {
                            Handler = "#{" + ID + "}.rowExpanderBeforeExpandHandler(this);"
                        }
                    },
                    
    
                };

    I have tried calling the plugin in Javascript and set the renderer once the the Parent Grid Panel is being initialized. But it doesn't hit the code at all.

    Javascript
    Ext.ux.RulesGridPanel = Ext.extend(Ext.ux.PagePartGridPanel,
    {
        constructor: function(config) {
            Ext.ux.RulesGridPanel.superclass.constructor.call(this, config);
        },
    
        initComponent: function () {
            Ext.ux.PagePartGridPanel.superclass.initComponent.apply(this, arguments);
            this.buildFirstLevel();        
    
            var grid = this;
            var components = grid.plugins;
            var re = components.find(comp => comp.proxyId === 'RulesRowExpander');
            re.renderer = function (v, p, record) {
                p.id = '';
                return '*';
            };
        }
    }
    Last edited by jenna; Jan 22, 2019 at 12:36 AM.
  2. #2
    Is there a JavaScript error in the browser Console?
    Geoffrey McGill
    Founder & CEO
  3. #3
    Hi Geoffrey,

    I've tried setting the listeners - Render, BeforeRender etc in C# class but it doesn't hit the javascript at all.

    private void InitializeRowExpander()
            {            
                var re = new RowExpander
    	        {
                    ID = "RulesRowExpander",
    	            Width = 50,
                    Listeners =
                    {
                        BeforeRender =
                        {
                            Handler = "#{" + ID + "}.beforeRenderListener(record.id);"
                        },
                        Render =
                        {
                            Handler = "#{" + ID + "}.onRenderListener(record.id);"
                        },
                        Expand =
                        {
                            Handler = "#{" + ID + "}.rowExpanderOnExpandListener(record.id);"
                        },
                        BeforeExpand =
                        {
                            Handler = "#{" + ID + "}.rowExpanderBeforeExpandHandler(this);"
                        }
                    },
                    
    
                };
                
                Plugins.Add(re);
    	    }

    Is that a correct way of setting renderer of rowexpander in code behind?

Similar Threads

  1. [CLOSED] RowExpander Renderer and store bind on this.record
    By registrator in forum 2.x Premium Help
    Replies: 5
    Last Post: May 26, 2015, 4:26 PM
  2. Replies: 4
    Last Post: Jan 18, 2015, 5:51 PM
  3. Replies: 5
    Last Post: Feb 03, 2014, 4:07 PM
  4. [CLOSED] RowExpander Plugin for Grid
    By craig2005 in forum 1.x Premium Help
    Replies: 16
    Last Post: Jul 14, 2011, 2:48 PM
  5. Rowexpander renderer
    By speedstepmem4 in forum 1.x Premium Help
    Replies: 1
    Last Post: Dec 21, 2008, 4:29 AM

Tags for this Thread

Posting Permissions