Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
12699 Lượt xem

Hi, I want to know how to color a field in the tree view list?

Example: to color in red the field my_field

Ảnh đại diện
Huỷ bỏ
Tác giả

Ok thanks, but in this way, the line will be colored in green or red. I want this: name will be colored in green and status in red for example. Thanks

Câu trả lời hay nhất

hi, for that you can mention a class attribute in your field which you need to change color and in your css file you can add the color or any style for that class, try like this below:

class="red_txt" />

then in css,

.red_txt {

color:red;

}


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi, use the below example code...

In py file

'status' : fields.selection([('single','Single'),('married','Married')],'Status?'),

In xml file

<tree string="Status" colors="red:shop=='single';green:shop=='married' ">

<field name="name"></field>

<field name="status"></field>

</tree>

Ảnh đại diện
Huỷ bỏ

This will colour the whole line, not one single field.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 15
12171
0
thg 3 15
4109
3
thg 10 17
17165
1
thg 3 15
6387
0
thg 3 15
7308