I’m developing an app which fetches some numeric data from an api and manifests it in a MDDataTable(I’m using Kivymd). I need to give each row different color based on its numeric values. Is it doable in Kivymd and this specific class(MDDataTable)?If yes, how?
I appreciate your answers. thanks.
Advertisement
Answer
I just found a way to do that. But it may causes serious problems to your app. Each MDDataTable object has a data_table attribute. This attribute has a sub-attribute named data, which contains all cells of data in your table. Each cell is saved as a dictionary containing multiple items as its properties, which among them, “background_color_cell” is the one I was looking for. So all I had to do was to iterate over the data dictionary and change the background color.