VSTS扩展网格控件标题样式

时间:2017-12-25 18:40:57

标签: javascript tfs azure-devops visual-studio-extensions

制作我自己的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,那么它可以完美地运行。

  • 我试过&#34; mystyle&#34; (双qoutes)。我收到语法错误
  • 我尝试了'mystyle&#39; (单身qoute)。我收到语法错误

任何人都可以提供帮助吗?

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/

1 个答案:

答案 0 :(得分:0)

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

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

相关问题