"Cannot read property 'node' of undefined" JS error when destroying buttons - Page 2

"Cannot read property 'node' of undefined" JS error when destroying buttons

2»

Replies

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Hi
    I managed to recreate the issue and also identify how to fix it. Please go to http://live.datatables.net/cikovika/3/edit
    Click on a row and edit, the fields show. Close form, click refresh and select a row and click Edit, the fields don't show. I think the issue is the editor gets reset becuase I have placed the editor js code inside initTable. Leaving the editor code inside the ready function but outside initTable fixes it. removing the template with the code as it is also fixes it. I think editor does not like resetting the template after a page load. Is this it?

  • allanallan Posts: 63,467Questions: 1Answers: 10,466 Site admin

    I think editor does not like resetting the template after a page load. Is this it?

    Correct. Editor removes the template element from the document, so there is nothing there to select on the second iteration. Way to workaround that? Use a cloned copy:

     template: $('#EditorForm').clone(),
    

    Allan

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Thanks

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3
    edited February 2020

    Hi
    There is a slight issue in that I use the Edit form template as a div at bottom of page and it seems editor via the clone method shows the div on the page. If I use $("#EditorForm").hide(); in js' doc ready I get the same problem as before where the fields don't show on the form. Putting a show in the open or preopen editor events does noithing. Kindly advise.

  • allanallan Posts: 63,467Questions: 1Answers: 10,466 Site admin

    You could wrap the EditorForm element in a div which is display:none.

    Allan

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Good point. Thanks.

This discussion has been closed.