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

<?php

declare(strict_types = 1);

use Nette\Utils\Json;
use TwiGrid\DataGrid;
use Nette\Forms\Container;
use Nette\Database\Explorer;
use Nette\Database\Table\ActiveRow;
use Nette\Database\Table\Selection;


final class InlineGrid extends DataGrid
{

	private Explorer $database;


	public function __construct(Explorer $database)
	{
		parent::__construct();

		$this->database = $database;
	}


	protected function build(): void
	{
		$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(static function (Container $container, ActiveRow $user): void {
			$container->addText('firstname')->setRequired();
			$container->addText('surname')->setRequired();
			$container->addTextArea('biography')->setRequired()->setHtmlAttribute('rows', 7);

			$container->setDefaults($user->toArray());

		}, function ($id, array $values): void {
			$this->flashMessage("[DEMO] Updating item '$id' with values " . Json::encode($values), 'success');
		});

		$this->setDataLoader(function (array $filters, array $order): Selection {
			return $this->database->table('user')
				->limit(12);
		});

		$this->setRecordVariable('user');
	}

}

# @inline.latte

{extends $defaultTemplate}


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