function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Navin Ganeshan 10Navin Ganeshan 10 

Refresh lwc-tree-grid on Click locally

Hi,

Hoping get some pointers on lightning-tree-grid from this group. in my LWC comp. i am displaying all roles in lwc tree grid with 2 additional cols as Read,  Write (as type button) 

What I am trying to achieve is, when a button is clicked for Read, set rows "Read" attribute as true and change button's icon to "action:approval". However, when I set the value for the row field, tree-grid does not refresh with the new icon.

Sample data: 
[
   {
      "roleId":"XXXX1",
      "name":"Global",
      "parentRoleId":null,
      "canRead":false,
      "canWrite":false,
      "iconName":"action:new",
      "_children":[
         {
            "roleId":"XXXX2",
            "name":"Global Child 1",
            "parentRoleId":"XXXX1",
            "canRead":false,
            "canWrite":false,
            "iconName":"action:new"
         },
         {
            "roleId":"XXXX3",
            "name":"Global Child 2",
            "parentRoleId":"XXXX1",
            "canRead":false,
            "canWrite":false,
            "iconName":"action:new"
         }
      ]
   }
]
rowAction:
handleRowAction(event) {
  const row = event.detail;
  row.canRead = true;
  row.iconName = "action:approval"
}
I would like to update the button icon, as soon as it clicked. Once user has selected as many rows as they would like, they would finally click on "Save" button to save the data. 

Question is, how to rerender the tree grid, to show the new icon. Please let me know if I could clarify the question further.

Thanks,
Navin