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 8814793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:13:05+00:00 2026-06-14T04:13:05+00:00

I’m beginning development of an app in extjs. I’m using the MVC approach, as

  • 0

I’m beginning development of an app in extjs. I’m using the MVC approach, as provided in the extjs documentation.

I have some dynamic data which needs to present the user with a set of accordion controls. I’ve got the data in a store, but I do not know how to dynamically create the accordion items (unlike grid panels, there doesn’t appear to be a store data method).

Here is my current accordion view code – with static items:

Ext.define('BP.view.induction.LeftPage', {
extend: 'Ext.Panel',
alias : 'widget.leftpage',

title: "Left Page", 
layout: {
    type: 'accordion',
    align: 'stretch'
},
layoutConfig: {
    // layout-specific configs go here
    titleCollapse: true,
    animate: true,
    activeOnTop: true
},
items: [{
    xtype: 'panel', // fake hidden panel, so all appear collapsed
    hidden: true,
    collapsed: false
},{
    xtype: 'panel',
    title: 'Panel 1',
    html: 'Panel content!'
},{
    xtype: 'panel',
    title: 'Panel 2',
    html: 'Panel content!'
},{
    xtype: 'panel',
    title: 'Panel 3',
    html: 'Panel content!'
}]
});

Any guidance on how to achieve the above would be appreciated, thank you.

[Edit] In response to sra’s request, here is my controller:

Ext.define('BP.controller.Induction', {
extend: 'Ext.app.Controller',

views: [
    'induction.Binder'
],

stores: [
    'Sections',
    'Categories',
    'Tasks'
],

init: function() {
    console.log('Initialized Induction!');
}
});

I should note here that this controller loads a parent view, which in turn loads the LeftPage view – I’m not sure if this creates any scoping issues. Furthermore, as you can see, more than one store is loaded.

  • 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-14T04:13:06+00:00Added an answer on June 14, 2026 at 4:13 am

    You can do like this (untested example with some tweaks)

    Ext.define('BP.view.induction.LeftPage', {
        extend: 'Ext.Panel',
        alias : 'widget.leftpage',
    
        title: "Left Page", 
        layout: null,
        layoutConfig: null,
        store: null,
        attentive: true,
        initComponent: function() {
            var me = this;
            // begin edit
            // only set the store if is is not already defined
            me.store = me.store ? me.store : Ext.StoreMgr.lookup('Sections');  // you may change this to any storename you want
            // end edit
            me.layout = { // don't set objects directly in class definitions
                type: 'accordion',
                align: 'stretch'
            };
            me.layoutConfig = { // dont set objects directly in class definitions
                titleCollapse: true,
                animate: true,
                activeOnTop: true
            };
    
            me.callParent(arguments);
            if (me.attentive) {
                me.store('load', me.onRebuildContent, me);
                if (me.store.count() == 0)
                    me.store.load();
            } else {
                me.buildContent(); 
            }
        },
        buildContent: function() {
            var me = this;
            function addItem(rec) {
                me.add({
                    xtype: 'panel',
                    title: rec.get('titleProperty'),
                    html: rec.get('bodyProprty')
                });
            };
    
            me.store.each(addItem);
        },
        onRebuildContent: function() {
            var me = this;
            me.removeAll();
            me.buildContent();
        }   
    });
    

    Your store will need at least two properties; one for the title and one for the content. And the store need to be loaded before you should instantiate this. But that can easily be done within your controller.

    Edit based on comment and new OP info:

    Well your view is a bit out of control of the controller. So I recommend you to simply use the StoreManager to receive a valid instance (I’ve edited the code, I just didn’T know the correct store to use). The StoreManager will know about the store as long as you list him within a controller (StoreManager is capable of much more, but that is all you need to know at the moment). For a further release you could also use the mixin bindable which would manage a storebinding more clean and enables you to update your accordion after the store receives new data (get updated)

    Edit for readability

    I’ve just cleaned it up a bit and included a switch param attentive which would allow you to use this component as directly bound to a store, reacting on all load events or as a sort of static one where the store should already be loaded. All in all this should give you a start without making it to complex.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
We're building an app, our first using Rails 3, and we're having to build
I have an autohotkey script which looks up a word in a bilingual dictionary
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.