Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ublaboo datagridd get id from latte to presenter

I use datagrid Ublaboo\Datagrid on my Nette project. This DataGrid is super, but I have one problem with get ID from component to presenter.

I have show.latte, that get ID to renderShow method in presenter

public function renderShow($id = null) {}

This is OK.

And I have in show.latte table list with datagrid.

   <div class="table-responsive">
       {control fileList}
    </div> 

Presenter:

public function createComponentFileList($name) {
  // return factory method
  return $grid
}

How do I get ID row from show.latte to presenter?

like image 929
ondrusu Avatar asked Jan 18 '26 05:01

ondrusu


1 Answers

You can't send information from a view (Latte) to a presenter because presenter methods are executed prior to rendering a view.

What do you need that id for? And which id: renderShow($id = null) seems to know $id already.

You could send information from a component to a presenter in component's method render() via $control->parent / $control->presenter. But again, it's not clear from your question, which id you mean. You don't seem to pass any $id from template to fileList:render() in {control fileList}. Also, at that point, presenter action/render methods have already been executed so I wonder what you'd like to do with that id.

You may have mixed up "presenter" with "component" in your question. You said renderShow() is in a presenter but you ask how to pass id from component to presenter.

"I have show.latte that get ID to renderShow" isn't a grammatically correct sentence. That adds yet another layer of confusion.

like image 52
Petr 'PePa' Pavel Avatar answered Jan 19 '26 17:01

Petr 'PePa' Pavel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!