Row selection

Info Works with Column Status

Method enableRowSelection

Without parameters

$grid->enableRowSelection();

Sample code

$selection = $grid->enableRowSelection();

$links = $selection->getLinks();

$links->addLink('Active')
->onCall[] = function () {
    print_r(func_get_args());
};
Info Got from $selection->getLinks()

Methods

Method Possible values Description Returns
addLink string $name Add and get new link to selection dropdown Mesour\DataGrid\Extensions\Selection\Link
addDivider none Add divider to selection dropdown Mesour\DataGrid\Extensions\Selection\Links
addHeader string $text, array $attributes = [] Add header to selection dropdown Mesour\DataGrid\Extensions\Selection\Links
getDropDown none Get selection dropdown instance Mesour\UI\DropDown

Methods

Method Possible values Description Returns
setAjax bool $ajax Call event by AJAX Mesour\DataGrid\Extensions\Selection\Link
setConfirm string $confirm Call JavaScript confirm(s) before go Mesour\DataGrid\Extensions\Selection\Link
getButton string $text, array $attributes = [] Add header to selection dropdown Mesour\UI\Button

Events

Event Parameters Description
onCall array $selectedItemIds Fired after used selected and clicked to some link in selection dropdown

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('basicDataGrid', $mesourApp);

$grid->setSource($source);

//! here enable selection
$selection = $grid->enableRowSelection();

//! here get LinksContainer from rowSelection extension
$links = $selection->getLinks();

$links->addLink('Active') //! add selection link
->onCall[] = function () {
    print_r(func_get_args());
};

$links->addLink('Inactive')
    ->setAjax(FALSE) //! disable AJAX
    ->onCall[] = function () {
    print_r(func_get_args());
};

$links->addLink('Delete')
    ->setConfirm('Really delete all selected users?') //! set confirm text
    ->onCall[] = function () {
    print_r(func_get_args());
};;

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

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

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

$grid->render();

Demo


NameSurnameE-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