mcanedo
mcanedo

Reputation: 445

How to refresh grid after update from modal form in atk4?

I have a page with a MVCGrid calling a modal form from external page:

$g1=$p->add('MVCGrid');
$g1->setModel('Student');
$g1->addButton('Add New') 
   ->js('click')
   ->univ()
   ->dialogURL('Add New', $this->api->getDestinationURL('newStudent'));

The external page has the form and works fine:

$f=$page->add('MVCForm');
$f->setModel('Student');
if($f->isSubmitted()){
    $f->update();
    $f->js()->univ()->closeDialog()->execute();
}

But after a new Student is added, the grid is not updated, how do I update it? Is this this the right way to do this? (I'm trying to have a similar function that the CRUD but only for Create.)

Upvotes: 1

Views: 463

Answers (1)

romaninsh
romaninsh

Reputation: 10664

It's exactly the same as https://stackoverflow.com/a/8966784/204819

put the refresh code as 2nd argument to js() function, while using "null" as first.

Upvotes: 3

Related Questions