This is a migrated thread and some comments may be shown as answers.

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

4 Answers 854 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Federico
Top achievements
Rank 1
Federico asked on 16 Jun 2017, 01:35 PM
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>

4 Answers, 1 is accepted

Sort by
0
Preslav
Telerik team
answered on 19 Jun 2017, 01:50 PM
Hello Federico,

This could be achieved by using the columns.attributes configuration:
For example:
<div data-role="grid"
data-toolbar="DOC"
data-columns="[
   { 'field': 'doc1', attributes: { style: 'background-color: green;'}},
   { 'field': 'doc2', attributes: { style: 'background-color: yellow;'}}      ]"
data-bind="source: sourceList"></div>



Regards,
Preslav
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Federico
Top achievements
Rank 1
answered on 19 Jun 2017, 02:02 PM
This solution doesn't work
0
Accepted
Preslav
Telerik team
answered on 19 Jun 2017, 03:09 PM
Hello Federico,

The code from my last reply works as expected on my side. For example, check this Dojo:
That said, could you please modify the above Dojo so it clearly replicates and isolates the issue and send it back with your next post.


Regards,
Preslav
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Federico
Top achievements
Rank 1
answered on 19 Jun 2017, 03:12 PM
Ok perfect, thanks

Tags
Grid
Asked by
Federico
Top achievements
Rank 1
Answers by
Preslav
Telerik team
Federico
Top achievements
Rank 1
Share this question
or