So just to add to the fun…
- if I remove the “‘EvenRowCssClass’='even’;” and “‘OddRowCssClass’='odd’;” lines from the $params hash table assignment and re-create the html, I get table rows with no classes assigned, but the even and odd rows are rendered differently, (i.e. even rows are grey, odd rows are white).
- If I rename the .odd and .even classes in the stylesheet to .odd2 and .even2, for example, and re-create the html, I get table rows with no classes assigned, and the even and odd rows are NOT rendered differently, (i.e. all rows are white).
- If I leave the classes renamed as .odd2 and .even2, change the colors to blue and pink, respectively, and then add the EvenRowCssClass and OddRowCssClass lines back to the hash table using .odd2 and .even2 class names, it works as expected. (I get odd lines that are blue and even ones that are pink)
I got to doing a little digging into jquerydatatable.js and then on the DataTables website and found that DataTables automagically uses the .odd and .even classes to style the rows. (See Striping on http://datatables.net/styling/custom_classes)
So now it at least makes sense! I have no idea why your example worked when you wrote the book and didn’t work this time, but at least I know why. If you want to use the same even and odd row styles for all DataTables on a page, then you can use the .odd and .even classes and there is no need to use the OddRowCssClass and EvenRowCssClass params for the ConvertTo-EnhancedHTMLFragment function. If however you are going to use different styles for different DataTables on the same page, make sure that you don’t have any classes named .odd and .even and use the OddRowCssClass and EvenRowCssClass params.