Add columns to JTGrid

Post Reply
Posts: 9
Joined: Mon Jun 17, 2013 2:56 pm

Add columns to JTGrid

Post by DIKonsult » Wed Oct 22, 2014 9:37 am

I try to set up a JTGrid dynamically from data in a Query, i.e create columns with names from my Query.
I can't find any methods like "AddColumn" or similar to use in a FOR ... DO loop or similar.
The help file only shows haw to do it with arrays.


Site Admin
Posts: 1954
Joined: Wed Oct 08, 2008 12:23 am

Re: Add columns to JTGrid

Post by jomitech » Mon Oct 27, 2014 8:03 am

You have to do it via arrays, unfortunately. For example:

Code: Select all

$columns = array();

foreach (...)
    $columns[] = array( $caption, $datafield, $width, $alignment, $format, $type, $params );

$this->JTGrid->Columns = $columns;

Post Reply