⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

add_action without modifying crud



richb201

richb201
  • profile picture
  • Member

Posted 18 October 2018 - 03:03 AM

I have a table where I have the lines:

 

$crud->add_action('Snapshot', '', 'Configure/snapshot', 'Select');

$output = $crud->render();

 

My function called snapshot:

public function snapshot($post_array, $primary_key)

{
echo '<script> window.postMessage({ type: "FROM_PAGE_TO_CONTENT_SCRIPT",text: "Hello from the webpage!" }, "*");</script>';
}

 

Snapshot uses javascript to write a message out to a content script.  I thought that after snapshot() runs, I would not even redraw the crud. But the crud blanks out the page. Any idea how I can get snapshot to run without affecting the UI?