VSTS扩展Grid Control标题样式

问题描述 投票:0回答:1

制作我自己的VSTS扩展。扩展返回一个网格,其中包含项目中的错误列表以及对这些错误进行的一些计算。

我想设置网格的标题,以使字体更大,背景不同。

我检查了MS(https://www.visualstudio.com/en-us/docs/integrate/extensions/reference/client/controls/grid)的文档,他们提到了指定HeaderCss类的可能性。所以我做了以下几点: - 我在我的html标题中创建了一个CSS类:

<head>
    <style>
    .mystyle {
        background-color: coral;
        color: white;
        font-size: 25px;
    }
    </style>
    <title>Weighted Defect Count Calculation</title>
    <script src="sdk/scripts/VSS.SDK.js"></script>
</head>

我在javascript中添加了类名,其中定义了网格列选项:

                         width: "100%",
                         height: "500px",
                         source: sourceArray,
                         columns: [
                             { text: "ID", index: 0, width: 100, HeaderCss: { mystyle } },
                             { text: "Title", index: 1, width: 200 },
                             { text: "State", index: 2, width: 100 },
                             { text: "Severity", index: 3, width: 200 },
                             { text: "Likelihood", index: 4, width: 200 },
                             { text: "Assigned To", index: 5, width: 300 },
                         ]

运行扩展程序时出现401 Unauthorized错误。如果我删除HeaderCss thingy然后它完美地工作。

  • 我试过“我的风格”(带双引号)。我得到语法错误
  • 我试过'我的风格'(单引号)。我得到语法错误

有人可以帮忙吗?

来自MS的文件:https://www.visualstudio.com/en-us/docs/integrate/extensions/reference/client/controls/grid

我遵循的教程是扩展到这里:http://nocture.dk/2016/01/02/lets-make-a-visual-studio-team-services-extension/

javascript tfs azure-devops visual-studio-extensions
1个回答
0
投票

使用headerCss:"mystyle"代替。 (第一个字符是小写)。

另一方面,headerCss的值是字符串而不是数组或对象。

© www.soinside.com 2019 - 2024. All rights reserved.