1

我有一个按钮问题。它出现在 IE 和 Firefox 中,但没有出现在 Chrome 中。

该按钮的代码使用 Rally API,它是在加载页面时生成的。

我试过谷歌搜索答案,但我找不到任何东西。

这是我的代码:

function onClick(b, args) {
    if(OneButtonClickFlag == true) {
        OneButtonClickFlag = false;
        var buttonValue = args.value;
        var userName = "__USER_NAME__";
        TimeSheetReport(); // calling the “timesheet report “

    }
}

function onLoad() {
    var config = {
        text: "Generate",
        value: "myValue"
    };

    var button = new rally.sdk.ui.basic.Button(config);
    button.display("buttonDiv", onClick); // call the “onclick” function 
}

rally.addOnLoad(onLoad);
4

1 回答 1

0

This App below seems to work with your code in it up until the point where it encounters your OneButtonClick flag. I tested it in Chrome. Does this work for you?

<head>
    <title>Button Example</title>
    <meta name="Name" content="Component Example: Button"
    />
    <meta name="Version" content="2010.4" />
    <meta name="Vendor" content="Rally Software" />
    <script type="text/javascript" src="https://rally1.rallydev.com/apps/1.26/sdk.js"></script>
    <script type="text/javascript">
        function onClick(b, args) {
            console.log("works until this undefined variable");
            if (OneButtonClickFlag == true) {
                OneButtonClickFlag = false;
                var buttonValue = args.value;
                var userName = "__USER_NAME__";
                TimeSheetReport(); // calling the “timesheet report “

            }
        }

        function onLoad() {
            var config = {
                text: "Generate",
                value: "myValue"
            };

            var button = new rally.sdk.ui.basic.Button(config);
            button.display("buttonDiv", onClick); // call the “onclick” function 
        }

        rally.addOnLoad(onLoad);
    </script>
</head>

<body>
    <div id="buttonDiv"></div>
</body>

于 2012-10-31T20:29:02.310 回答