• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home » Resolved: how to style different tables ag-grid?

Resolved: how to style different tables ag-grid?

0
By Isaac Tonny on 18/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

SITUATION #1: I have tables with different styles. When I go back to Table №1, Table №3, and Table №4 it takes styles from Table №2. How can I apply styles to Table №2 for this table only? Is there a style prefix for different tables?
The global style for Table №1, Table №3, and Table №4 are called grid-custom.css:
For Table №2 I have local styles called grid.css:
return:
====================================================
The first situation is done. When just one id is applied to the table it works.
SITUATION #2: I have global styles that apply to two tables. But after global styles, I need to apply a separate style for each table border-radius. In this case works just for #table1. Why? Same styles:
Id for each table:
and same return for both:

Answer:

You have 2 CSS files. Assuming, global file as which is applied on App.js for all components, and local for specific component. If you specifically want to apply css to Table 2 only then you need to assign id to div like this :
Then inside CSS:
Now, above CSS will only apply to id with table2 not on other tables
UPDATE:
The CSS is only getting applied on one table and not on other table. I can’t figure it out why! But using 4th method: CSS Modules, I managed to get the result.
Create a file named like style.module.css. Inside the file write your CSS
Then import this file in your component like this:
Then, add className to your div
Same with table2, and you can remove id from divs as they are of no use now.

If you have better answer, please add a comment about this, thank you!

ag-grid ag-grid-react reactjs
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: net::ERR_HTTP2_PROTOCOL_ERROR by http get request angular 15.2

02/04/2023

Resolved: How do I stop the command from happening if the requirements for it to work aren’t sert Discord.js

02/04/2023

Resolved: How to scroll bottom of div at launch?

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.