Search code examples
extjsgridtooltipcellbackground-color

How to dynamically update grid cell color and tool tip based on user action in Extjs 4?


Based on a user action, like click of a button, we need to update a grid cell and modify its background color and tool-tip.

Please note that it has to be only a particular cell of grid record and not the entire column affecting all the records.

Thus, how can we update these two things for a particular grid record cell - background color and tool-tip - dynamically?

Thanks for help in advance.

PS: ExtJs version 4.1.1


Solution

  • I have been able to find a solution for this. Though, not sure if its the best way, but posting it here as it may help someone looking for the same.

    The solution is to write custom renderer function for the column which needs to be updated and calling the following code on the user action at which the update is required (like in the handler of the button clicked):

     grid.getView().refresh();
    

    The above code will invoke the column renderer function and this renderer function should be able to judge which background color and tool-tip to be applied at the grid column as per the current state of application.

    Hope this helps.