views:

47

answers:

1

iam using leigeber's sorting javascript to sort my data on my page......i took the js from here :- leigeber's sorting javascript

Now this is shwoing highlighted sorted column and all and its all perfect.Now iam having some negative and some positive values in my data and i want to show those negative data in red color and positive in green.This whole sorting thing is using js and css to do the highlighting and sorting.Iam a bit confused now and cant make it out that how i can assign red color to the negative ones and green to the positive ones as js is returning the data as an object i.e. a complete row and i cant make 1 column's data red or green.Will it be done by js itself or with the help of stylesheet to find -ves and +ves.Im totally lost and dont know how to do it.Please help!!!!

this is an example of hte data iam using this whole sorting thing on:-

-Name-  -Price- -loss-  -Pts-
abc     361.15  -5.68   -21.75
abc2   1072.35  -5.24   -59.25
abc3    512.35   5.24    28.35
abc4    335.2   -5.02   -17.7
abc5    318.6    5.01   -16.8
abc6    76.15   -4.15    3.3
+1  A: 

The sorting script you are referring to doesn't seem to support the kind of coloration you want (nor should it), so you will have to do that part manually. The sorting does preserve existing coloration though, so if you set a color (using a style attribute) on a cell when you build the table, that cell will keep that color.

Jakob Kruse
iam doing exactly that in my php but my js is not taking those colors and showing same black color :(
developer
what happening is that this new stylesheet coding is not letting my older stylesheet coding work :(
developer
if you use a style attribute on the table cells there is no stylesheet involved.
Jakob Kruse
got your point!! its working now thanks!!
developer
Great. Don't forget to vote and accept :)
Jakob Kruse
Job Done :D ....
developer