使用Javascript将图表添加到特定选项卡面板 [英] Add Chart to Specific Tab Panel Using Javascript

查看:68
本文介绍了使用Javascript将图表添加到特定选项卡面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我根据用户从列表框中选择的内容,在标签容器中动态创建了许多标签面板。如果用户从列表框中选择了item1和item2,则会创建2个选项卡面板,其中标签ID和标题文本为item1和item2。



我想在图表中添加chartID'chart1'到选项卡面板'item1',将'chart2'添加到选项卡面板'item2'。我想使用javascript检查选项卡面板'item1'和'item2'是否存在,可以通过tab id或tab headertext进行检查。这就像选项卡面板'item1'存在,添加'chart1',然后如果'item2'存在,添加'chart2',如果'item3'存在,添加'chart3',依此类推......



这是我目前的代码,但无效..

Hi, I have many tab panels being created dynamically in tab container based on what the user has selected from a listbox. If user has selected 'item1' and 'item2' from listbox, 2 tab panels will be created with tab ID and header text as 'item1' and 'item2'.

I would like to add in chart with chartID 'chart1' into tab panel 'item1' and 'chart2' into tab panel 'item2'. I want to use javascript to check if tab panel 'item1' and 'item2' exist, can check by tab id or tab headertext. It is something like if tab panel 'item1' exist, add 'chart1', then if 'item2' exist, add 'chart2', if 'item3' exist, add 'chart3', and so on..

This is my codes currently, but is not working..

$(function () {
    $("#RETRIEVE_BUTTON").click(function () {
        var str = "Item 1";

        if (str != "") {
            $("panel").each(function () {
                var title = $(this).text();
                if (str == title) {
                    alert("existing");
                }
            })
        }
    })
})





感谢有人能为我提供帮助。谢谢!



Appreciate if someone could provide me help on this. Thanks!

推荐答案

(function(){
(function () {


#RETRIEVE_BUTTON)。click(function(){
var str = 项目1;

如果(str!= ){
("#RETRIEVE_BUTTON").click(function () { var str = "Item 1"; if (str != "") {


panel)。each(function(){
var title =
("panel").each(function () { var title =


这篇关于使用Javascript将图表添加到特定选项卡面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆