[jQuery] Re: Change row colors of table based on content

2009-10-20 Thread gjha...@gmail.com
Thanks for the solutions, I have figured out solutions like yours, but I tought that may exists less-code solutions, so I opened this thread. Thanks anyway, great solutions. On Tue, Oct 20, 2009 at 00:18, Charlie wrote: > I try to learn as much as I can from this sort of exercise. > > I made a

[jQuery] Re: Change row colors of table based on content

2009-10-19 Thread Charlie
I try to learn as much as I can from this sort of exercise. I made a couple of revisions to previously untested version, went back and made a couple of syntax and code fixes to previously untested suggestion I only submit this because it works on a limited sized table with simple names, not

[jQuery] Re: Change row colors of table based on content

2009-10-19 Thread Charlie
Bi Jing wrote: I like this issue and following is my draft implement, its working on IE/FF, hope it helps Firstly, I suggest adding a class to COSTUMER column that gonna making things easier. HTML sample code:         1         dd         cc         ss         ss                    

[jQuery] Re: Change row colors of table based on content

2009-10-19 Thread Bi Jing
I like this issue and following is my draft implement, its working on IE/FF, hope it helps Firstly, I suggest adding a class to COSTUMER column that gonna making things easier. HTML sample code: 1 dd cc ss ss 2 22 33

[jQuery] Re: Change row colors of table based on content

2009-10-19 Thread Charlie
my starting thought would be use the name as a class, assign a color to class perhaps from an array of colors so you could have 10 colors and use them in order for first ten unique names, then repeat for next 10 unique names use a length ( or size) test to see if that class already exists, if

[jQuery] Re: Change row colors of table based on content

2009-10-19 Thread Jeffrey Kretz
Put together a hashtable of colors based on the customer name. Something like this (untested): var hash = {}; $('#tableid tr').each(function(i){ var tr = $(this); var customer = $.trim(tr.children('td:eq(1)').html()); var color = hash[customer]; if (!color) { has