Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mark Ritter on Oct 20, 2008 18:20
open dhtmlx forum
addListOption()

I have created a new 2.0 toolbar with an .addButtonSelect() item. I create it in JS with the array style you provide.

    MainToolBar=new dhtmlXToolbarObject("MainToolBar");
    MainToolBar.setIconsPath("./Themes/"+Theme+"/imgs/");

    MainToolBar.addButton("0_new", 0, getText(lblNew), "New.png");
    MainToolBar.addButton("0_open", 1, getText(lblOpen), "Open.png");
    MainToolBar.addButton("0_save", 2, getText(lblSave), "Save.png");
    MainToolBar.addButton("0_saveas", 3, getText(lblSaveAs), "SaveAs.png");
    MainToolBar.addSeparator("sep0", 4);
    MainToolBar.addButton("0_install", 5, getText(lblInstall), "Install.png");
    MainToolBar.addSeparator("sep1", 6);
    MainToolBar.addButtonTwoState("0_options", 7, getText(lblOptionsWizard), "Options.png", "Options_Disabled.png");
    MainToolBar.addButtonTwoState("0_config", 8, getText(lblConfigWizard), "Config.png", "Config_Disabled.png");
    MainToolBar.addSeparator("sep2", 9);
    MainToolBar.addButtonTwoState("0_manual", 10, getText(lblManual), "Help.png", "Help_Disabled.png");
    MainToolBar.addSeparator("sep3", 11);
    var IDs = Array(Array('default', 'obj', getText(lblSelectDefaults)),
                Array('all', 'obj', getText(lblSelectAll)),
                Array('none', 'obj', getText(lblSelectNone)),
                Array('sep0', 'sep'));
    MainToolBar.addButtonSelect("0_configs", 12, getText(lblConfigurations), IDs);


It displays fine. But I can not add more items to the array. I am using this:

    if (Configurations.length>0 && Configurations[0] != "")
    {
        for (var i=0; i<Configurations.length; i++)
        {
            var id=Configurations[i];
            var name=Configurations[i];

            MainToolBar.addListOption('0_configs', id, i+4, 'obj', name, null);
        }
    }


This works fine for dhtmlxMenu. But no items get appended to the toolbar array.
Answer posted by Support on Oct 21, 2008 06:38
Try the following way:
....
 MainToolBar.addListOption('0_configs', id, i+4, 'button', name, null);
Answer posted by Mark Ritter on Oct 21, 2008 12:47

That worked.  Thanks.