Agile Toolkit : Redirect on another page with arguments

343 Views Asked by At

I just started learning ATK.

In my project, I have a grid of a Model 'A'. There are many rows for Model 'A'.

I have a separate page for that Model that shows its details.

Now, I want, my grid rows clickable and it should redirect to that page with 'ID' as argument. So, I can get it and load it again. To show its details on that page.

How to achieve this?

1

There are 1 best solutions below

0
romaninsh On

It should be easily possible with ->on handler.

$page=$this->api->url('./subpage');

if($crud->grid) {
    $crud->grid->on('click','tr')->univ()->location(
        array($page, 'id'=>$this->js()->_selectorThis()->data('id'))
    );
}

if ->on() is not working in your version of toolkit, you can also use ->js('click')->_selector('#'.$crud->grid->getJSID().' tr')->univ()->location......;

Some documentation here:

https://github.com/atk4/atk4/blob/4.3/lib/AbstractView.php#L546