- Moodle v3.6.3
- Table to display in a plugin.
My current code:
$table = new html_table();
$table->id = 'table-jxx';
$table->attributes['data-toggle'] = 'table';
$table->attributes['data-url'] = $url;
$table_head = array(get_string("course", "document"),
get_string("teacher", "document"),
get_string("modulename", "assign"),
str_replace(" ", "<br/>", get_string("documents_number", "document")),
get_string("minimum", "document"),
get_string("maximum", "document"),
get_string("average", "document"));
$table->head = $table_head;
foreach ($rows as $row){
$table>data[] = array ($row["course"],$row["teacher"], $row["assign"], $row["analyzed_documents_count"], $row["minimum_rate"], $row["maximum_rate"], $row["average_rate"]);
}
echo html_writer::table($table);
How can I put attributes to the "th" elements of the table?
something like this ....
table->head->attribute=array('data-sortable'=>'true');