Image column

Implements

Methods for Mesour\DataGrid\Column\Image

Method Default Possible values Returns Required Description
setMaxWidth none string Number or "80px", "1em"... Mesour\DataGrid\Column\Image no Set max image width
setMaxHeight none string Number or "80px", "1em"... Mesour\DataGrid\Column\Image no Set max image height
setPreviewPath none, $_SERVER['DOCUMENT_ROOT'], $_SERVER['DOCUMENT_ROOT'] $previewWebPath, $previewRootPath = NULL, $imageRootPath = NULL Mesour\DataGrid\Column\Image no Set preview path for resizing images
setCallback none callable $callback Mesour\DataGrid\Column\Image no If you use callback, column shows output of this callback as image src attribute (only if not using temp dir and image resize)

Callback parameters for method setCallback

Parameter Type Description
$column Mesour\DataGrid\Column\Image Image column instance
$rowData Mesour\Sources\ArrayHash / Entity / ActiveRow Data for current row

Events

Info See onRenderon events page

Usage

$mesourApp = //instance Mesour\Components\Application\IApplication
$source = //some <a href="http://components.mesour.com/version3/component/sources/" target="_blank">data source</a> or two-dimensional array

$grid = new Mesour\UI\DataGrid('numberDataGrid', $mesourApp);

$grid->setSource($source);

//! here add image column
$grid->addImage('avatar', 'Avatar')
    ->setPreviewPath(
        '/avatar/preview',
        __DIR__ . '/../../../htdocs',
        __DIR__ . '/../../../htdocs'
    )
    ->setMaxHeight(80) // translated as max-height: 80px;
    ->setMaxWidth(80); // can use 80, "80px", "1em"...

$grid->addText('name', 'Name');

$grid->addText('surname', 'Surname');

$grid->addText('email', 'E-mail');

Demo


AvatarNameSurnameE-mail
JohnDoejohn.doe@test.xx
PeterLarsonpeter.larson@test.xx
ClaudeGravesclaude.graves@test.xx
StuartNormanstuart.norman@test.xx
KathyArnoldkathy.arnold@test.xx
JanWilsonjan.wilson@test.xx
AlbertaEricksonalberta.erickson@test.xx
AdaWellsada.wells@test.xx
EthelFigueroaethel.figueroa@test.xx
IanGoodwinian.goodwin@test.xx
FrancisHayesfrancis.hayes@test.xx
ErmaBurnserma.burns@test.xx
KristinaJenkinskristina.jenkins@test.xx
VirgilHuntvirgil.hunt@test.xx
MaxMartinmax.martin@test.xx
MelodyManningmelody.manning@test.xx
CatherineToddcatherine.todd@test.xx
DouglasStanleydouglas.stanley@test.xx
PattiDiazpatti.diaz@test.xx
JohnPettersonjohn.petterson@test.xx