0

我有以下dojojavascript 代码来获取我的选项卡和子选项卡的点击TabContainer/ContentPanes并获取它们的选项卡 ID。这是唯一适用于子标签的代码,所有其他标签选择代码仅适用于父标签。

// Pickup the onClick and get the ID of the tab or sub tab being clicked, this is used in the case switch statement for updating the grid accordingly
    var tabContainerPanel = registry.byId('myDivID');   //get dijit from its source dom element

    on(tabContainerPanel, "Click", function (event) {
        selectedTabString = tabContainerPanel.selectedChildWidget.title;

        if (typeof tabContainerPanel.selectedChildWidget.selectedChildWidget !== 'undefined'){
            // There are no child tabs, parent tab only
            selectedTabString = tabContainerPanel.selectedChildWidget.selectedChildWidget.title;
        }
        // Update tab you selected when you select it! setGridData will update it every 10 seconds after it is selected.
        switch (selectedTabString) {
            case "blah1":
                Some code blah blah;
                break;
            case "blah2":
                Some code blah blah;
                break;
And so on...another 13 cases...

我的问题是,当我在位于 mydojo gridx中的 a 内的对象内单击时,该对象被捕获并导致仅为选项卡 onClicks 指定的其他代码被执行,并且它阻止了我的鼠标单击对单元格中的组件正常工作类似按钮和可编辑文本区域等。ContentPaneTabContaineronClickdojogridx

如何让选项卡onClick代码仅在选项卡本身而不是子对象上工作?

这是我添加gridx到的方式TabContainer

    // Every tab is a TabContaner, including sub tabs. Tabs and sub tabs contain ContentPane objects
    var tcmain = new TabContainer({doLayout: false}, 'myDivID');

    var tab1 = new ContentPane({title: "Tab1", content: gridx1});

    var tab2 = new TabContainer({title: "Tab2", doLayout: false, nested: true});
    var tab2Child1 = new ContentPane({title: "Tab2child1", content: gridx2});
    var tab2Child2 = new ContentPane({title: "Tab2Child2", content: gridx3});

    // tab2
    tab2.addChild(tab2Child1);
    tab2.addChild(tab2Child2);

    // Add Parent tabs to main TabContainer, tcmain. Parent Tabs contain their child tab objects
    tcmain.addChild(tab1);
    tcmain.addChild(tab2);


<Code example ABOVE is incerted here>


    tcmain.startup();
4

0 回答 0