Tip: When inside a textarea, use [Ctrl] + [Enter] to submit the form.
Tip: Press [Ctrl] + Click to activate inline editing and [Esc] to cancel it.
Name
Surname
Biography
Country
 
Martina Trommler Pork belly filet mignon ribeye ham meatloaf, turducken sirloin kielbasa andouille flank tenderloin short ribs drumstick. Spare ribs chuck pork belly sirloin andouille. Drumstick turducken chicken prosciutto, sirloin brisket ball tip hamburger t-bone jowl… is
Marij Rašpolić Venison bacon capicola hamburger, flank meatloaf ribeye bresaola pork prosciutto shoulder rump turducken pork loin. Salami meatloaf beef, tail pork loin short loin meatball. Ham sausage corned beef swine prosciutto andouille pork loin, chuck ham hock… ca
Lyyli Vaara Doner prosciutto kielbasa boudin pork, tongue tri-tip. Prosciutto corned beef tongue jerky, boudin meatloaf pork chop kielbasa pig pastrami. Shank sausage pancetta cow turkey kielbasa t-bone fatback tri-tip beef ribs. Sirloin jowl turkey, pancetta corned… fi
Dýrleif Björnsdóttir Short loin spare ribs cow, pork chop ground round pancetta swine turducken biltong sausage capicola shankle andouille bresaola ribeye. Tri-tip tail salami pork belly. T-bone doner tail pastrami venison jowl. Flank sirloin hamburger, meatloaf rump chicken… it
Martha Yohannes Meatball pork loin swine t-bone brisket. Pork belly kielbasa hamburger brisket, rump shoulder shankle short ribs chicken pork loin. Swine chuck jerky, shank hamburger pork loin doner pancetta tenderloin ground round t-bone pork bacon. Beef shank ball tip… pl
Amadi Onyekachukwu Ham venison spare ribs, short ribs ball tip meatloaf pastrami beef ground round kielbasa biltong drumstick chicken pork chop beef ribs. T-bone swine tongue turducken chicken ball tip, meatloaf biltong pork loin turkey brisket doner jerky. Ham prosciutto… it
Satu Tukio Sausage andouille spare ribs, sirloin pancetta bacon salami. Shoulder jerky salami tri-tip. Cow shankle corned beef ball tip pork chop, biltong turducken shoulder tongue short ribs flank ribeye fatback. Pastrami spare ribs bresaola, short ribs meatball… au
Mary Black Rump shoulder tenderloin, pig t-bone chicken meatball cow turkey short loin meatloaf swine capicola. Tail rump kielbasa bacon capicola turducken pork leberkas chuck. Turducken tri-tip frankfurter, short ribs pork swine pastrami. Rump meatloaf pancetta… is
Consuela Takens Pork meatball t-bone tongue ham hock sirloin capicola ribeye pancetta swine. Shank sausage strip steak meatball, prosciutto biltong sirloin shankle venison pork belly. Shankle strip steak t-bone, tail turducken sirloin kielbasa prosciutto beef pastrami… is
Aaya Weerdenburg Meatball ham hock turducken rump spare ribs pork loin sirloin tongue pork chop ribeye. Chicken fatback shank ham hock strip steak tenderloin beef ribs pork loin jowl beef. Andouille tongue pork chop fatback ham tri-tip chicken venison bresaola. Kielbasa… it
Ormos Széll Pork ham hock ham tail, strip steak leberkas shoulder kielbasa pork belly bacon drumstick flank cow meatloaf turkey. Tongue jowl boudin leberkas, swine chuck cow salami andouille pork loin venison. Jowl ball tip doner, ground round pork kielbasa andouille… pl
Hrvojka Petković Pork belly ribeye hamburger corned beef sausage swine ball tip leberkas doner sirloin fatback ground round ham hock tail. Bacon pork chop short loin, ball tip pancetta turkey strip steak sirloin. Biltong strip steak beef ribs, chicken short ribs jerky… fi

Code

# InlineGrid.php


class InlineGrid extends BaseGrid
{

	/** @return void */
	protected function build()
	{
		parent::build();

		$this->setTemplateFile(__DIR__ . '/@inline.latte');

		$this->setPrimaryKey('id');
		$this->addColumn('firstname', 'Name');
		$this->addColumn('surname', 'Surname');
		$this->addColumn('biography', 'Biography');
		$this->addColumn('country_code', 'Country');

		$this->setInlineEditing([$this, 'inlineEditFactory'], function ($id, Nette\Utils\ArrayHash $values) {
			$this->flashMessage("[DEMO] Updating item '$id' with values " . Nette\Utils\Json::encode($values), 'success');
		});

		$this->setDataLoader([$this, 'dataLoader']);
	}


	/**
	 * @param  Nette\Database\Table\ActiveRow $record
	 * @return Nette\Forms\Container
	 */
	public function inlineEditFactory(Nette\Database\Table\ActiveRow $record)
	{
		$c = new Nette\Forms\Container;

		$c->addText('firstname')->setRequired();
		$c->addText('surname')->setRequired();
		$c->addTextarea('biography')->setRequired()->setAttribute('rows', 7);

		$c->setDefaults($record->toArray());

		return $c;
	}


	/**
	 * @param  InlineGrid $grid
	 * @param  array $filters
	 * @param  array $order
	 * @return Nette\Database\Table\Selection
	 */
	public function dataLoader(InlineGrid $grid, array $filters, array $order)
	{
		return $this->database->table('user')
			->limit(12);
	}

}
	

# BaseGrid.php


use Nette\Http\Session as NSession;
use Nette\Database\Context as NdbContext;


abstract class BaseGrid extends TwiGrid\DataGrid
{

	/** @var NdbContext */
	protected $database;


	/**
	 * @param  NSession $session
	 * @param  NdbContext $database
	 */
	public function __construct(NSession $session, NdbContext $database)
	{
		parent::__construct($session);
		$this->database = $database;
	}


	/** @return void */
	protected function build()
	{
		parent::build();
		$this->setRecordVariable('user');
	}

}
	

# @inline.latte


{extends $defaultTemplate}


{define body-cell-biography}
	<td>{$user->biography |truncate:256}</td>
{/define}