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

5 posts, 1 answers
  1. Federico
    Federico avatar
    8 posts
    Member since:
    Jun 2017

    Posted 16 Jun 2017 Link to this post

    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>
  2. Preslav
    Admin
    Preslav avatar
    576 posts

    Posted 19 Jun 2017 Link to this post

    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.
  3. Federico
    Federico avatar
    8 posts
    Member since:
    Jun 2017

    Posted 19 Jun 2017 in reply to Preslav Link to this post

    This solution doesn't work
  4. Answer
    Preslav
    Admin
    Preslav avatar
    576 posts

    Posted 19 Jun 2017 Link to this post

    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.
  5. Federico
    Federico avatar
    8 posts
    Member since:
    Jun 2017

    Posted 19 Jun 2017 Link to this post

    Ok perfect, thanks

Back to Top