KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Add number column to a table #3338

Open saiful opened this topic on on Sep 18, 2024 - 1 comments

S
saiful commented on Sep 18, 2024

hello, I need to add a number column for my table. I found the RowNumColumn process but the results were in the last column. how to move it to first place?

the script

the result

S
Sebastian Morales commented on Sep 18, 2024

You can modify each data row like this to make column "No." at the first:

        ->pipe(new Custom(function($row){
            $newRow = [];
            $newRow["No."] = $row["No."]; // set the first key and value
            foreach ($row as $k => $v) $newRow[$k] = $v;
            return $newRow;
        }))

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

Excel