Table Class issues - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Table Class issues (/showthread.php?tid=5103) |
Table Class issues - El Forum - 01-06-2008 [eluser]shiggins[/eluser] Does anyone understand why when using the table class, style attributes only apply to the first row? Code: $tmpl = array ( 'table_open' => '<table border="0" width="100%" cellpadding="2" cellspacing="0" align="left">', When looping through a set of records the style class 'tblcell' is only applied to the first set of records. Thanks in advance! Table Class issues - El Forum - 01-06-2008 [eluser]axle_foley00[/eluser] shiggins: I'm not quite sure why it's only happening to the first row for you. I did however notice that it seems when you specify a style on a table cell/row, the table that is generated alternates the style for every other row by default. So in other words you will end up with something like this being generated: Code: <table border="0" width="100%" cellpadding="2" cellspacing="0" align="left"> Is this what is happening to you? Could you show us an example of your controller code? Edit: I'm thinking that you may want to specifiy some additional template configurations, so that the alternate rows have the same styles as the others. So your template config would look like this instead: Code: $tmpl = array ( Notice the last 4 configuration items are similar to the 4 items just above it. I don't think it should be necessary to use those last 4 items unless you actually want the rows to alternate. But it might help in your case. Does anyone else notice that it automatically alternates the rows? UPDATE: Actually I just looked through the HTML Table Class Library and it has a default template config. So just in case you don't set a particular template config item, it will use the one from the default template. Perhaps that could be why you are having this problem. Table Class issues - El Forum - 01-06-2008 [eluser]shiggins[/eluser] I know that using row_alt_start is designed to allow alternating style values such as row colors, but I'm not looking for that. All I need is for each row to use the same class.. Code: //set table headings Above code is used to create the table and loop through the records. Table Class issues - El Forum - 01-06-2008 [eluser]axle_foley00[/eluser] Hmm...I tried my best to replicate what you had done, but I'm not having any problems with the cells as you described. Any particular reason why the TYPE and MANUFACTURER columns are blank or were those taken out just for the sample in your post? Could you also post a sample of the HTML table that was generated? |