Fixes and few new features (insert, delete)#92
Conversation
It suppress warning: call_user_func() expects parameter 1 to be a valid callback
Filter buttons 'Filter' and 'Cancel' are renderen in an actions column.
Form can be already customized by renderer. Translator can be already set.
Helps when adding templates on different places. By factory or by descendant __constructor().
|
😮 wow. thanks, will go through. please ping me often if not :D |
hrach
left a comment
There was a problem hiding this comment.
Looks great, though it's getting preeeeetttyyyy complicated. Some doc would be generally needed for the new functionality. (see docs folder in repo)
| <a href="{link edit! $primary}" class="ajax" data-datagrid-edit>{$control->translate(Edit)}</a> | ||
| {/define} | ||
|
|
||
| {define row-edit-control} |
| {/if} | ||
| {/define} | ||
|
|
||
| {define row-head-cell} |
| protected $grid; | ||
|
|
||
| /** @var array */ | ||
| protected $attributes = []; |
There was a problem hiding this comment.
For example
$grid->addColumn('institute')->setAttribute('help', 'School where you ...');and then you can render nice help icon in column head.
| $form['filter'] = call_user_func($this->filterFormFactory); | ||
| if (!isset($form['filter']['filter'])) { | ||
| $form['filter']->addSubmit('filter', $this->translate('Filter'))->setValidationScope($form['filter']->getControls()); | ||
| $form['filter']->addSubmit('filter', 'Filter')->setValidationScope($form['filter']->getControls()); |
There was a problem hiding this comment.
ok, this is probably BC break, should be marked
| <p class="error" n:foreach="$formContainer[$column->name]->getErrors() as $error">{$error}</p> | ||
| {/define} | ||
|
|
||
| {define row-insert-control} |
| {ifset #empty-result}{include #empty-result}{/ifset} | ||
| {/if} | ||
| </tbody> | ||
| <tfoot n:ifset="$form[insert]"> |
There was a problem hiding this comment.
Is it tfoot corrent for inserting?
There was a problem hiding this comment.
Not sure where to render. In header, it can be accidentally interchanged with filter by user.
There was a problem hiding this comment.
I mean like last tbody's tr? But probbaly its ok :) /shrug
| $allowRedirect = true; | ||
| if (isset($form['insert']) && $form['insert']['button']->isSubmittedBy()) { | ||
| if ($form['insert']['data']->isValid()) { | ||
| call_user_func($this->insertFormCallback, $form['insert']['data']); |
There was a problem hiding this comment.
You were adding checks elsewhere, but here we are missing, though I'm probably ok.
There was a problem hiding this comment.
Check is only on data source callback. Without it, grid cannot be rendered. And when I was beginner with this grid, warning was pretty confusing.
Missing handlers callbacks are IMHO "OK". Warning in production, not exception.
| {input button} | ||
| {/define} | ||
|
|
||
| {define row-actions-delete-link} |
It's not. INSERT, DELETE and better rendering granularity 😄 |
|
Thanks for review, but sorry, I have no time to finish it :( |
|
If you don't mind I will reopen and merge & finish one time :) |
|
Sure 👍 |
Hi,
would you accept some of proposed features? It is extraction of some which I'm using in local fork.