Help Reset Zebra (after className change)

Help Reset Zebra (after className change)

ericmfultonericmfulton Posts: 3Questions: 0Answers: 0
edited May 2012 in General
Hey,

First post and i'm a big newbie so I apologize for any faux pas.

I have a table where when you click on a button in a row, it should change the color of that row by changing the class name from:

gradeB to gradeX

The problem is that once the table is initialized, the classname changes to "gradeB odd" or gradeB even." When i manually change the classname to "gradeX" I only get "gradeX" and not "gradeX even/odd." The only way I can seem to force the odd/even stuff to recalculate is by manually hitting a TH to resort the table. That somehow also recalculates odd even stuff.

I'd greatly appreciate any help. Below is a snippet of my code:
//Change Color
that.parentElement.parentElement.className = "gradeX";

//Get Index
var dex = tab1Reference.fnGetPosition(that.parentNode.parentNode);

//Change Status
tab1Reference.fnUpdate("Urgent", dex, 5, true);

=====>Purpose: Things that are urgent in my table should be red("gradeX"), otherwise they should be blue("gradeB").

Thanks for any help!!!

Replies

  • ericmfultonericmfulton Posts: 3Questions: 0Answers: 0
    At this point just disabling the zebra'ing would be ok too. I'm pretty desperate to get this baby working.
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    To disable zebra striping set asStripeClasses to be an empty array.

    > The only way I can seem to force the odd/even stuff to recalculate is by manually hitting a TH to resort the table.

    Call fnDraw - that will reorganising the classes.

    > that.parentElement.parentElement.className = "gradeX";

    It would probably be better to use $().addClass() and $().removeClass() since that won't kill the odd/even classes.

    Allan
  • ericmfultonericmfulton Posts: 3Questions: 0Answers: 0
    Allan,

    Thank you so much!!!!!!!! Using addClass and removeClass did the trick. Everything is working perfectly now. I can't tell you how much time I've spent trying to figure this one out. I really really appreciate your help!

    Thanks!
This discussion has been closed.