莱格伯排序的问题
我使用 leigeber 的排序 javascript 对我的页面上的数据进行排序......我从这里获取了 js :- leigeber 的排序 javascript
现在显示突出显示的排序列及其全部完美。现在我的数据中有一些负值和一些正值,我想用红色显示这些负值数据,用绿色显示正值。整个排序工作是使用 js 和 css 来突出显示和排序。我有点困惑现在我无法弄清楚如何将红色分配给负数,将绿色分配给正数,因为 js 将数据作为对象返回,即完整的行,而我无法将 1 列的数据设置为红色或绿色。会是吗?由js本身完成或在样式表的帮助下找到-ves和+ves。我完全迷失了,不知道该怎么做。请帮忙!!!!
这是 hte 数据 iam 使用整个排序的示例:-
-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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所指的排序脚本似乎不支持您想要的着色类型(也不应该支持),因此您必须手动执行该部分。不过,排序确实会保留现有的颜色,因此如果您在构建表格时在单元格上设置颜色(使用样式属性),则该单元格将保留该颜色。
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.