简体   繁体   English

如何在MVVM中更改网格列的颜色?

[英]How to change the color of a grid column in MVVM?

How to change the color of a grid column in MVVM? 如何在MVVM中更改网格列的颜色? i would like something like this: 我想要这样的事情:

first column: green 第一列:绿色

second column: yellow 第二栏:黄色

<div data-role="grid"
             data-toolbar="DOC"
             data-columns="[
                             { 'field': 'doc1'},
                             { 'field': 'doc2' }
                          ]"
             data-bind="source: sourceList"></div>

i would like to get something like this image: 我想得到这样的图像: 在此处输入图片说明

You can add the following style to your CSS or page: 您可以在CSS或页面中添加以下样式:

#grid th:nth-child(1) {
  background: green;
}

#grid th:nth-child(2) {
  background: yellow;
}

You'll need to set the selectors according to your setup. 您需要根据设置来设置选择器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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