fixed cell data comparison
fixed cell data comparison
Hi,
I want to compare each avarage value with john's age.
if avarage value > John's value avarage value font must red
if avarage value < John's value avarage value font must green
For example
for john ------- 40 > 30 avarege value font red
Marry 35 > 30 font red
Herry 50 > 30 font red
George 20 < 30 font green
Suzan 18 < 30 font green
Alice 60 > 40 font red
Bruce 70 > 30 font red
Tom 10 < 30 font green
Thank you.
Replies
The
rowCallback
option is one way to achieve this. Please post an updated example if you need help with getting it working.Kevin
An example http://live.datatables.net/mayasike/1/edit
Here is an example:
http://live.datatables.net/mayasike/4/edit
Kevin
Sorry, back tracked and found your attempts. I think this example is more what you are looking for:
http://live.datatables.net/jiteyura/1/edit
Kevin
This example for same row data. But my fixed value is = 30
all age data mus be compere with 30
sorry avarage data mus be compere with 30
There is not much difference in the code but my first example compares to 30:
http://live.datatables.net/mayasike/4/edit
Kevin
You are right. But 30 is fixed in your example. But I have get the value( Johns' age) with a code. Because it may change
I'm not totally clear what you want to do. Maybe you can update one of my examples with what you want and if you still have questions post an explanation with the link to your updated example.
Kevin
Ok, that helps. How are you deciding to compare with John versus the others?
Kevin
I try to explain
I have to get John s' age .It will be my fixed value.( In the example 30). Name of John will be always in my other several json file.Because its' age is a kind of my secret key.
Is it possible to return the value of John's age in each row of data from your server script? If so then the data can easily be accessed but you don't need to display it in the table.
Are you using arrays or objects?
Are you using ajax to get the data?
The more specific you can be about your data, data structures, etc the easier it will be to help.
Kevin
about my project:
How and when do you decide to compare John's age? Answering this will help determine where to get the age from.
Is it always John?
Can the user select John or another student to compare ages?
Can there be more than one John?
Kevin