Skip to content

Commit

Permalink
Added event InlineEdit::$onCustomRedraw, which - if not empty - disab…
Browse files Browse the repository at this point in the history
…les one ow redrawing and lets user to decide what snippets to redraw, closes contributte#214
  • Loading branch information
paveljanda committed May 26, 2016
1 parent 3164b1b commit 2d07427
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/DataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -1425,18 +1425,17 @@ public function filterSucceeded(Form $form)

if ($edit['submit']->isSubmittedBy()) {
$this->inlineEdit->onSubmit($id, $values->inline_edit);
$this->getPresenter()->payload->_datagrid_inline_edited = $id;
} else {
$this->getPresenter()->payload->_datagrid_inline_edit_cancel = $id;
}

if ($this->getPresenter()->isAjax()) {
if ($edit['submit']->isSubmittedBy()) {
$this->getPresenter()->payload->_datagrid_inline_edited = $id;
} else {
$this->getPresenter()->payload->_datagrid_inline_edit_cancel = $id;
}
if ($edit['submit']->isSubmittedBy() && !empty($this->inlineEdit->onCustomRedraw)) {
$this->inlineEdit->onCustomRedraw();
} else {
$this->redrawItem($id, $primary_where_column);
}

$this->redrawItem($id, $primary_where_column);

return;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/InlineEdit/InlineEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class InlineEdit extends Nette\Object
*/
public $onSetDefaults;

/**
* @var callable[]
*/
public $onCustomRedraw;

/**
* @var mixed
*/
Expand Down

0 comments on commit 2d07427

Please sign in to comment.