简体   繁体   中英

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

How to change the color of a grid column in 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:

#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.

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