-
Notifications
You must be signed in to change notification settings - Fork 934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change style of an element of a column by comparing it with a value of other column of the same row. #1039
Comments
I believe you can do something similar to my example here: Except that instead of For example:
But be warned that the way in which you'll refer to your A[i] an B[i] data is by numerical index (column #). So if you add or rearrange columns your application will break until you figures out what the proper indexes should be. Shameless plug: If the suggestions from #1038 and #1040 become implemented then you could refer to your other data points by key instead of numerical index. And accessing related data points that weren't pushed into the table would also be trivial. Eg |
Okay got it. Thanks |
I have a similar situation - i have, within the table's raw data, modified the data, but it isn't "committed" - The application of the change to the file system is something I want a confirmation for on a single click (updating ID3 info in a collection of files, and/or moving the files based on that info and other data). Re: #1038 this is a frustration in that it sometimes is there. It is the raw data if the table is sorted, but is the processed row otherwise. And i'm pretty sure that IS a bug. :D my data is 'flat' - i just want to read from a different raw value. E.g., row['year'] unless row['year.modified'] exists, then instead render modified (with a BG color in the span to indicate it is changed). To solve consistently, I basically have to put the render method into the component so it gets the raw table data in the closure, then I match rows by a key column (column 0 is the full file path, which will be unique) to find the modified property to render instead. I can't just map a column to 'modfied' for each one - there's just too many columns that way and the table is unreadable. I mean, potentially I could, with the modified column hidden (And can't be added) and then the renderer for the main looks up the modified one (which means it has to iterate around column order to find it - already that's a risk with my key column 0 approach as it is - and then render that value instead with the styles if it is not undefined. But that's getting to be a lot more work. Granted, if the key column and the modified columns are all first, then theoretically their indexes shouldn't change as other columns are sorted, but i haven't gotten far enough to confirm that. |
I have data having two columns A and B. Now i want to set the color of ith element of B to green if B[i] > A[i] , else set it to red.
Any idea how it can be achieved using MUI Datatables ?
The text was updated successfully, but these errors were encountered: