I'm just getting started here so I am a bit retarded on how to submit a issue and patch.
Your for loop leaves an extra , at the end of $rowJS.... This causes YUI Datatable to fail to load the table in IE and Firefox 3
foreach ($header as $row) {
if (is_array($row)) {
if ($row['data'] == NULL) {
$row['data'] = ' ';
}
if (isset($row['sort'])) {
$sort = ", { sortedBy : { key: '" . str_replace(' ', '', $row['data']) . "', dir : '" . $row['sort'] . "' } } ";
}
$rowJS .= "{ className : '" . $row['class'] . "', key : '" . str_replace(' ', '', $row['data']) . "', label : '" . $row['data'] . "', sortable : " . (isset($row['field']) ? 'true' : 'false') . " },";
}
else {
$rowJS .= "{ key : '$row', label : '$row', editor: new YAHOO.widget.TextareaCellEditor({disableBtns:true}) },";
}
}
I added this after the loop to correct the problem:
$rowJS=substr($rowJS,0,strlen($rowJS)-1);
If anyone wants to help me be less retarded about this process please get in touch with a tutorial link or something... I'd love to help and properly...
Comments
Comment #1
bdmc commentedI did it slightly differently, adding a comma before each element AFTER the first.
I have also updated my copy to YUI 2.8.2, and added a Formatter element to the ColumnDefs, so that numeric columns sort correctly, among other items.