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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:28:17+00:00 2026-05-27T04:28:17+00:00

I want to add programatically 4 children to dijit.layout.AccordionContainer . The script runs with

  • 0

I want to add programatically 4 children to dijit.layout.AccordionContainer. The script runs with no errors, but it only adds 2 children, no matter how I try to achieve this. From my debug using firebug it looks like the scripts stops after adding second child. I tried following suggestions from here, here and here, but I found no solution.

Some code:
AccordionContainer definition:

var listaWyjazdow = new dijit.layout.AccordionContainer({}, "target-lista-wyjazdow");

listaWyjazdow.startup();

aktualizujListeWyjazdow();

function to add 4 children to AccordionContainer:

function aktualizujListeWyjazdow(){
dojo.require("dijit.layout.AccordionPane");

var lista = dijit.byId('target-lista-wyjazdow');
lista.destroyDescendants();

var tablica = new dojo.data.ItemFileReadStore({
    url: "logika/getJSON/getWyjazdy.php",
    clearOnClose: true,
    urlPreventCache: true
}).fetch({
    query: {id: '*'},
    sort: {attribute: 'data', descending: true},
    start: 0,
    count: 4,
    onComplete: function(dane){
        console.log(dane);
        var ile = dane.length;
        var i = 0;
        var dzieci = new Array();

                    //this works for 2 children only:
        for (i = 0; i < ile; i++){
            var szczegoly = 'Klient: <strong>' + dane[i].klient + '</strong></br>';
            szczegoly += 'Osoba wyjeżdżająca: <strong>' + dane[i].wyjezdzajacy + '</strong></br>';

            dzieci[i] = new dijit.layout.AccordionPane({
                id: "wyjazd" + i,
                title: "Wyjazd: " + dane[i].data,
                content: szczegoly
            });
            console.log(dane[i]);
            console.log(i + ' - ' + ile);
            lista.addChild(dzieci[i], 0);
            lista.selectChild(dijit.byId('wyjazd' + i));
            //console.log(lista);
        }
                    //this works for 2 children only:
        /*lista.addChild(dzieci[0]);
        console.log(0);
        lista.addChild(dzieci[1]);
        console.log(1);
        lista.addChild(dzieci[2]);
        console.log(2);
        lista.addChild(dzieci[3]);
        console.log(3);*/

                    //this outputs all children:
        /*console.log(dzieci[0]);
        console.log(dzieci[1]);
        console.log(dzieci[2]);
        console.log(dzieci[3]);*/

                    //this works for 2 children only:
        /*for (i = 0; i < ile; i++){
            lista.addChild(dzieci[i]);
            console.log(dzieci[i]);
        }*/
    }
});
}

console output (from firebug):

[Object { id=[1], etykieta=[1], data=[1], more...}, Object { id=[1], etykieta=[1], data=[1], more...}, Object { id=[1], etykieta=[1], data=[1], more...}, Object { id=[1], etykieta=[1], data=[1], more...}]

Object { id=[1], etykieta=[1], data=[1], more...}

0 - 4

Object { id=[1], etykieta=[1], data=[1], more...}

1 - 4

Any help would be greatly appreciated!

EDIT
a little update:
in my ItemFileReadStore object value returned by url is json:

{
    "identifier": "id",
    "label": "etykieta",
    "items": [
        {
            "id": "1",
            "etykieta": "Wyjazd0",
            "data": "06-10-2011",
            "wyjezdzajacy": "cblajszczak",
            "idKlienta": "1",
            "klient": "klient testowy",
            "zadanieQS": null,
            "dataKolejnegoWyjazdu": null,
            "lacznyCzasWyjazdu": "0"
        },
        {
            "id": "3",
            "etykieta": "Wyjazd1",
            "data": "15-11-2011",
            "wyjezdzajacy": "cblajszczak",
            "idKlienta": "1",
            "klient": "klient testowy",
            "zadanieQS": null,
            "dataKolejnegoWyjazdu": null,
            "lacznyCzasWyjazdu": "0"
        },
        {
            "id": "5",
            "etykieta": "Wyjazd2",
            "data": "30-11-2011",
            "wyjezdzajacy": "cblajszczak",
            "idKlienta": "1",
            "klient": "klient testowy",
            "zadanieQS": null,
            "dataKolejnegoWyjazdu": null,
            "lacznyCzasWyjazdu": "0"
        },
        {
            "id": "4",
            "etykieta": "Wyjazd3",
            "data": "24-11-2011",
            "wyjezdzajacy": "cblajszczak",
            "idKlienta": "2",
            "klient": "hfhhfhd",
            "zadanieQS": null,
            "dataKolejnegoWyjazdu": null,
            "lacznyCzasWyjazdu": "0"
        }
    ]
}

dane[2] has following structure (taken from firebug):

_0 2
_RI true
_S Object { _arrayOfAllItems=[4], _arrayOfTopLevelItems=[4], _loadFinished=true, more...}
data ["30-11-2011"]
[other fields from json structure]

I have noticed that _S shown above contains whole dane array. And this dane contains another _S with whole dane array. And so on, recursively – could this be the problem?

  • 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-05-27T04:28:17+00:00Added an answer on May 27, 2026 at 4:28 am

    I finally managed to solve my problem. In case anyone else encounters similar problem, the solution is to create container (AccordionContainer in this case) declaratively, not programmatically:
    <div id="id" style="height:50%" dojoType="dijit.layout.AccordionContainer"></div>

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

Sidebar

Related Questions

I want to add a column programatically to my datagrid and bind it. I
I've programatically created a number of files. I want to add them to the
I want to be able to programatically add a new cron job, what is
I want to add known JPA entities programatically when creating EntityManagerFactory. So I have
Whenever i want to add a javascript library programatically, say jquery for example, it
I am having listview in linear layout, where I need to programatically add button.
I have a UIViewController with a XIB and want to add programmatically another subview.
I want to add haptic feedback to my application's buttons and control them programmatically
How do I programmatically add user permissions to a list in Sharepoint? I want
I want to programmatically create a new log4j ConsoleAppender and add it as an

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.