Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

change color List view (grid) with condition

Posted on by Microsoft Employee

Hi All,

I'm trying to change row color of my list view (grid) by condition.

Any idea please?

  • Suggested answer
    CU13072322-0 Profile Picture
    CU13072322-0 on at
    change color List view (grid) with condition
    Color Grid for Microsoft Dynamics 365
     
    Hi, did you try Color Grid for Microsoft Dynamics 365, this is highly configurable solution, and you can apply almost any data conditions very similar we have in advanced find.
     
    Key Features include:
    • Any cell and row level colors.
    • Advanced find type conditions.
    • Font formatting 
    • Conditional emojis in cell
     
  • Arslan001 Profile Picture
    Arslan001 60 on at
    RE: change color List view (grid) with condition

    Dallen 

    Hello Dallen.

    I am looking to research and experiment with Scripts that would accomplish this on both CRM Views and CRM Dashboards. Have you been able to successfully implement this in Sandbox or Production? I would appreciate any help and direction on this.

    Thank you and Best Regards,

    Arslan

  • Dallen Profile Picture
    Dallen 5 on at
    RE: change color List view (grid) with condition

    1. get rowid

    2. get the row element

    3. set the css

    var str = JSON.parse(rowData);

    var rowId = str.RowId;

    $("div[row-id='"+rowId+"']").css("background-color","green");

    $("div[row-id='"+rowId+"'] div span").css("color","white");

  • Arslan001 Profile Picture
    Arslan001 60 on at
    RE: change color List view (grid) with condition

    Hey Phuoc. I am interested in implementing this for our organization? just curious about how and why it is unsupported solution?

    Regards, Arslan

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: change color List view (grid) with condition

    thank you Samira,

    but, when i implement your code the first choice disappeared from the list.

    maybe here i have a problem in the name of 'tr'.

    haw can i find it?

  • Suggested answer
    SamiraM Profile Picture
    SamiraM 565 on at
    RE: change color List view (grid) with condition

    Check My JS below:

    function showEventStatusNew(rowData, userLCID) {

       debugger;

       if (rowData == null || rowData == 'undefined') return;

       // read rowdata

       var str = JSON.parse(rowData);

       var coldata = str.new_statoevento_Value;

       var rowId = str.RowId;

       var opened = str.new_opened_Value;

       if (coldata == null || coldata == 'undefined' || coldata.length < 1) return;

       if (!opened) {

           switch (coldata) {

               case 2:

                   $("tr[oid='" + rowId + "']").css('fontWeight', 'bold');

                   //       $('span:contains("Attivo")').parent().parent().css('fontWeight', 'bold');

                   break;

               case 0:

                   $("tr[oid='" + rowId + "']").css('fontWeight', 'bold');

                   break;

               default:

                   break;

           }

       }

    }

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: change color List view (grid) with condition

    Hi,

    This is not supported solution to change the row color in Grid.

    try this solution: docs.microsoft.com/.../display-custom-icons-instead

  • meelamri Profile Picture
    meelamri 13,198 User Group Leader on at
    RE: change color List view (grid) with condition

    I agree that this may work. However, this approach is not supported. Indeed, according to Microsoft, DOM manipulation is not supported.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: change color List view (grid) with condition

    Hi Mehdi,

    the best solution is with Js.

    @samira Mirza gave me an good link. but just i don't know how to find the 'td' in the JS proposed.

    arpitmscrmhunt.blogspot.com/.../dynamics-crm-dynamically-change-row.html

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,198 User Group Leader on at
    RE: change color List view (grid) with condition

    Hi,

    I don't think there is a supported way to implement your scenario. I suggest you look for or implement a PCF Control that meets your needs.

    Another approach would be to use custom icons on one of the columns of your grid. Indeed, this approach is supported..you can find the details of the implementation here: docs.microsoft.com/.../display-custom-icons-instead

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans