Nested DataTable and editor within editor window not working

Nested DataTable and editor within editor window not working

handstand2001handstand2001 Posts: 3Questions: 1Answers: 0

I've been working on a couple of joined tables (recipe / ingredient), and so far I have a table that shows ingredients (editable using inline), and a table that shows recipes (editable with jqueryui editor). The goal is to make the editor jqueryui display a list of ingredients for the selected recipe, and be able to add/edit/delete entries.

What I've done is create a display controller that, in the "open" function, creates dom nodes so the result is a table within my recipe editor jqueryui. This new table is then initialized as it's own DataTable with it's own editor and ajax. Both the child editor and child table both use an ajax modify function so it sends the ID of the recipe in the ajax, so the PHP script can correctly join the recipe and ingredient tables and retrieves only ingredients for the specified recipe (the new DataTable does retrieve and display the correct data).

The problem I'm having is that it whenever I try to save changes to an ingredient amount (by selecting a recipe and editing the amount in the dynamically-created ingredient table), I get a JS error:

Uncaught TypeError: Cannot read property 'canReturnSubmit' of null
    at HTMLDocument.<anonymous> (dataTables.editor.js:21)
    at HTMLDocument.dispatch (jquery.js:5226)
    at HTMLDocument.elemData.handle (jquery.js:4878)

The new values are saved, but the table does not update (until I manually have it reload values from DB) and the jqueryui of the editor does not go away (or if I set it to inline edit, it stays as an editable input, rather than reverting to a table value - same error occurs)

I would prefer not to post the website here, but I have attached the relevant code. If there appears to be anything missing, I'd be happy to provide it.

I have not provided the SQL for the tables or the PHP for the tables, but can if necessary. This looks like a JS problem to me though, so didn't see the need to include.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin

    Would you be okay sending me a private message with the web-site address so I can check it out directly? PM me by clicking my forum user name above and then the "Send message" button.

    Thanks,
    Allan

  • handstand2001handstand2001 Posts: 3Questions: 1Answers: 0

    Done - Thanks

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin
    Answer ✓

    Perfect - thanks. I think you've hit a bug in 1.8.1 here I'm afraid. I've sent a PM back.

    Allan

  • handstand2001handstand2001 Posts: 3Questions: 1Answers: 0

    Hey Allan,
    Thanks for your help, but even after doing the fix, it's having the same error.

This discussion has been closed.