PHP code example of jzechy / zetgrid

1. Go to this page and download the library: Download jzechy/zetgrid library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jzechy / zetgrid example snippets


protected function createComponentUserGrid() {
		$grid = $this->gridFactory->create();

		$header = $grid->addHeader();
		$header->addColumn("#");
		$header->addColumn("Uživatelské jméno");
		$header->addColumn("Email");
		$header->addColumn();

		foreach($this->getUsers() as $user) {
			$row = $grid->addRow();
			$row->addColumn($user->getId());
			$row->addColumn($user->getUsername());
			$row->addColumn($user->getEmail())
				->setLink("mailto:". $user->getEmail());

			$buttons = $row->addColumn()->addClass("text-right");
			$buttons->addButton()
				->addAttribute("title", "Upravit uživatele")
				->addClass("btn btn-warning btn-xs")
				->setIcon("glyphicon glyphicon-pencil")
				->setLink($this->link("edit", $user->getId()));
			$buttons->addButton()
				->addAttribute("title", "Smazat uživatele")
				->addClass("btn btn-danger btn-xs")
				->setIcon("glyphicon glyphicon-remove")
				->setLink($this->link("delete", $user->getId()));
		}

		return $grid;
	}