Add custom link to ExportOptions - Warning: Attempt to read property "Visible" on null

I am getting this error message for the following code for “Add a custom link” in page_load by List"Warning: Attempt to read property “Visible” on null in C:\xampp\htdocs\protokoll\src\ListOptions.php on line 377 My Link"

  function Page_Load() {
      $this->ExportOptions->add("MyName")->setBody("<a class='my-class' href='MyURL'>My Link</a>");
 }

Where to check?

mpol_ch

You may copy the code in src\ListOptions.php file on line 377 for more discussion.

In addition, you should enable Debug and post the complete stack trace.

I had the same problem and I solved it by checking the flag “Export” under the “Table-specific options” section “List Page