Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8054561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:10:38+00:00 2026-06-05T08:10:38+00:00

I have a requirement to extend the YUI Panel with some custom functionality that

  • 0

I have a requirement to extend the YUI Panel with some custom functionality that will be in a new file and shared across multiple views.

I am at a bit of a loss as to how best to go about this, can anyone give me any pointers please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:10:41+00:00Added an answer on June 5, 2026 at 8:10 am

    Let’s say you want to extend a Panel to create one that has a list in its body. I usually use Y.Base.create for this. It’s a more declarative way of extending YUI classes than using a constructor and Y.extend. But I’ll stay closer to your example in the YUI forums.

    There are a couple of tricks dealing with WidgetStdMod (one of the components of Y.Panel), but mostly it’s just about using Y.extend and following the YUI inheritance patterns. I’ll try to answer with an example:

    function MyPanel() {
        MyPanel.superclass.constructor.apply(this, arguments);
    }
    // hack: call it the same so you get the same css class names
    // this is good for demos and tests. probably not for real life
    MyPanel.NAME = 'panel';
    
    MyPanel.ATTRS = {
        listItems: {
            // YUI now clones this array, so all's right with the world
            value: []
        },
        bodyContent: {
            // we want this so that WidgetStdMod creates the body node
            // and we can insert our list inside it
            value: ''
        }
    };
    
    Y.extend(MyPanel, Y.Panel, {
        // always a nice idea to keep templates in the prototype
        LIST_TEMPLATE: '<ul class="yui3-panel-list"></ul>',
    
        initializer: function (config) {
            // you'll probably want to use progressive enhancement here
            this._listContainer = Y.Node.create(this.LIST_TEMPLATE);
    
            // initializer is also the place where you'll want to instantiate other
            // objects that will live inside the panel
        },
    
        renderUI: function () {
            // you're inheriting from Panel, so you'll want to keep its rendering logic
            // renderUI/bindUI/syncUI don't call the superclass automatically like
            // initializer and destructor
            MyPanel.superclass.renderUI.call(this);
    
            // Normally we would append stuff to the body in the renderUI method
            // Unfortunately, as of 3.5.0 YUI still removes all content from the body
            // during renderUI, so we either hack it or do everything in syncUI
            // Hacking WidgetStdModNode is doable but I don't have the code around
            // and I haven't memorized it
            //var body = this.getStdModNode('body');
        },
    
        syncUI: function () {
            // same here
            MyPanel.superclass.syncUI.call(this);
    
            // insert stuff in the body node
            var listContainer = this._listContainer.appendTo(this.getStdModNode('body'));
    
            Y.Array.each(this.get('listItems'), function (item) {
                listContainer.append('<li>' + item + '</li>');
            });
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a requirement to build a custom multiselect box with jquery that will
In our project we have requirement that, after receiving sms message from third party
I have a requirement to write HTML to the file system and I was
I have a requirement to use a Fund model in my code. It will
Our customer has a requirement to extend the functionality of their existing large government
I think this question is quite common. Recently I have got a requirement that
I have an ASP.NET web site that will use Active Directory to store Users.
I have a class that uses an add-on template to add additional functionality as
I have the requirement that whenever there is a model get's added/changed/deleted, it should
I have a custom intranet application that has no interoperability requirements. We programatically construct

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.