Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Commit

Permalink
Edit row form & new row form can be now validated
Browse files Browse the repository at this point in the history
  • Loading branch information
holubj committed Sep 15, 2012
1 parent 2e47f72 commit 4e8fdfa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
24 changes: 21 additions & 3 deletions Grid.php
Expand Up @@ -193,6 +193,19 @@ public function findSubGridPath($gridName)
}
}

/**
* @param string $columnName
* @return \Nette\Forms\IControl
* @throws UnknownColumnException
*/
public function getColumnInput($columnName)
{
if(!$this->columnExists($columnName)){
throw new UnknownColumnException("Column $columnName doesn't exists.");
}
return $this['gridForm'][$this->name]['rowForm'][$columnName];
}

/**
* @param string $name
* @param null|string $label
Expand Down Expand Up @@ -354,7 +367,7 @@ public function setWidth($width)
$this->width = $width;
}

/**
/**
* @param string $messageNoRecords
*/
public function setMessageNoRecords($messageNoRecords)
Expand Down Expand Up @@ -706,11 +719,13 @@ protected function createComponentGridForm()
$form[$this->name]['rowForm']['send']->getControlPrototype()->addClass("grid-editable");

$form[$this->name]->addContainer("filter");
$form[$this->name]['filter']->addSubmit("send","Filtrovat");
$form[$this->name]['filter']->addSubmit("send","Filtrovat")
->setValidationScope(FALSE);

$form[$this->name]->addContainer("action");
$form[$this->name]['action']->addSelect("action_name","Označené:");
$form[$this->name]['action']->addSubmit("send","Potvrdit")
->setValidationScope(FALSE)
->getControlPrototype()
->addData("select", $form[$this->name]["action"]["action_name"]->getControl()->name);

Expand All @@ -720,7 +735,10 @@ protected function createComponentGridForm()
->addClass("grid-changeperpage")
->addData("gridname", $this->getGridPath())
->addData("link", $this->link("changePerPage!"));
$form[$this->name]['perPage']->addSubmit("send","Ok")->getControlPrototype()->addClass("grid-perpagesubmit");
$form[$this->name]['perPage']->addSubmit("send","Ok")
->setValidationScope(FALSE)
->getControlPrototype()
->addClass("grid-perpagesubmit");

$form->onSuccess[] = callback($this, "processGridForm");

Expand Down
8 changes: 7 additions & 1 deletion templates/grid.latte
Expand Up @@ -17,7 +17,7 @@
<tr class="grid-panel">
<th colspan="{$colsCount}">
<div class="grid-upper-panel">
<div n:if="$control->hasGlobalButtons()" class="grid-global-buttons">
<div n:if="$control->hasGlobalButtons()">
{foreach $globalButtons as $globalButton}
{control $globalButton}
{/foreach}
Expand All @@ -37,6 +37,12 @@
<div class="grid-flash-hide"></div>
</th>
</tr>
<tr class="grid-flash grid-error" n:foreach="$control['gridForm']->errors as $error">
<th colspan="{$colsCount}">
<span>{$error}</span>
<div class="grid-flash-hide"></div>
</th>
</tr>
<tr>
<th n:if="$control->hasActionForm()" style="text-align:center; width: 16px;" class="grid-head-column"><input type="checkbox" class="grid-select-all" title="Označit/odznačit všechny záznamy"></th>
<th n:foreach="$subGrids as $subGrid" style="width: 26px;" class="grid-head-column"></th>
Expand Down

0 comments on commit 4e8fdfa

Please sign in to comment.