Hi Deborah,
It works pretty much the same as the attendances.php page.
I see the table isn't rendered properly with the javascript widget because the 'userpic' column's header is empty. A quick fix for that is to change
$table->head[] = '';
to
$table->head[] = 'Pic';
Now the % column will appear but it still doesn't sort properly. It sorts by string rather than by integer. So % between 1 and 9 (& 100 %) will appear in strange places...
To get it to sort properly with the dhtml grid is possible but might be bit complicated:
See http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=11236&ssr=yes&s=grid%20sort%20html
To do the sort the way you are thinking is probably not going to work unless you change the whole way the code works for this report: You might need to use the flexible_table class from tablelib.php instead of the print_table (from weblib.php). It has built in table sorting capabilities.
There are probably other ways of doing it as well: Replacing the foreach php loops with sql as far as possible and building your sort string in the sql with extra sort paramaters for the % column.
Lastly, the dhtmlxGrid can also be initialised from a database call rather than by transforming the already rendered html. have a look at the documentation, examples and knowledgebase at dthmlx.com if you want. It's quite straightforward and they have loads of examples.
Cheers,
Barry
Attendance (plugin)
Status sorting & column resizing for the Report page
This discussion has been locked so you can no longer reply to it.