Tabella Example

basic complex editable download


Editable Tabella

IdSurnameNameSexSonsDaughtersBorn+
113Male001970/01/01
112MrdatiKrtkyMale33231970/01/01
111fdsfsMartin VocásekFemale201970/01/01
110xcycyxfrgdf12313Male1231231231231970/01/01
109sdfsdfMale001970/01/01
1081xxxxMale001970/01/01
107SefcikjjhgFemale001970/01/01
106asdffjokMale001901/12/13
105nazdarFemale001970/01/01
1041fodfsgfdFemale021970/01/01
103ccoolMale001970/01/01
102dsfgdfgrootMale001970/01/01
101hustýMichalMale001970/01/01
100fffFemale001970/01/01
99ZkouškaassadasdZkouškadfsdfFemale002012/03/11

	  
	protected function createComponentEditableTabella($name) {
		$model = $this->context->model; // in PHP 5.4 won't be necessary
		$grid = new Tabella(array(
				'context'  => $this->context,
				'source'   => $this->context->model->users->source(),
		 		'limit'    => 15,
		 		'sorting'  => 'desc',
		 		'onSubmit' => function($post) use ($model) {
		 			$post['born'] = strtotime($post['born']);
		 			$model->users->save($post);
				},
				'onDelete' => function($id) use ($model) {
					//$model->users->delete($id);
				}
			));

		$grid->addColumn('Id', 'id', array(
				'width' => 30
			));

		$grid->addColumn('Surname', 'surname', array(
				'width'    => 100,
				'editable' => true
			));

		$grid->addColumn('Name', 'name', array(
				'width'    => 100,
				'editable' => true
			));

		$grid->addColumn('Sex', 'sex', array(
				'type'     => Tabella::SELECT,
				'options'  => array('male' => 'Male', 'female' => 'Female'),
				'width'    => 50,
				'editable' => true,
			));

		$grid->addColumn('Sons', 'sons', array(
				'width'    => 65,
				'editable' => true
			));

		$grid->addColumn('Daughters', 'daughters', array(
				'width'   => 65,
				'editable' => true
			));

		$grid->addColumn('Born', 'born', array(
				'type' => Tabella::DATE,
				'dateFormat' => '%Y/%m/%d',
				'editable' => true
			));

		$grid->addColumn('+', Tabella::ADD, array(
				'type' => Tabella::DELETE
			));

		$this->addComponent($grid, $name);
	}
	

(c) 2011 Vojtěch Knyttl, New BSD Licence. Tlumočení francouzštiny. Kulturní přehled.