简体   繁体   中英

Chrome Browser Issue for Button

I have an issue with a Button. It is appearing in IE and Firefox, but not appearing in Chrome.

The code for the button is using Rally API and it's generated while loading the page.

I have tried Googling the answer, but I couldn't find anything.

Heres my code:

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);

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM