Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Let's say, based on the user input, the table I get is like Table 1 generated from the SQL statement.
However, I would like to add the number column as shown in Table 2, where the Department is numbered based on their Division.
If the user did not select any of the department, the numbering will vary. So, how to display the number column that can change according to the department selected by the user? Could this be done?
Appreciate your help.
Thanks a lot.
Hello, I use this code to display the row number, but I would like to know if there is a way to restart the count from 1 for each grouping?
"columns"=>array(
"#"=>array(
"label"=>"N.",
"start"=>1,
"cssStyle"=>"text-align:right"
),
...
"grouping"=>array(
"PROV"=>array(...
)
),
Pls try to use "formatValue" function with $value and $row arguments like this:
$lastGroup = null;
Table::create(array(
...
"columns" => array(
"#"=>array(
"start"=>0,
"formatValue"=>function($value, $row) use (& $lastGroup)
{
//use $row and $lastGroup to determine if this row contains a new group.
//if new group reset $start = 1 else $start = $start + 1
}
),
Let us know if you have any difficulty. Rgds,
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo