Complex data and editing partial data

Complex data and editing partial data

KimvdLindeKimvdLinde Posts: 30Questions: 8Answers: 0

I have a table in which in one of the cells, I have multiple people records that are linked to that specific row. I would like to be able to edit those people independent from the row as a whole as that number of people varies between rows. Each record has its own enclosing div with the ID of the person in it. Is this possible, and if so, how?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    That does sound possible. You'd basically create a second Editor instance for the inner tables (just a single instance for all should do) and use whatever event handlers you need to trigger the editing (click to edit button for example).

    You would also need to tell the server the id of the parent row that is being edited. That could be done in a hidden field who's value is set after you start editing field().val()) or use ajax.data to add it to the data sent to the server.

    Allan

  • KimvdLindeKimvdLinde Posts: 30Questions: 8Answers: 0

    Okay, I will try to figure out the inner tables then....

  • KimvdLindeKimvdLinde Posts: 30Questions: 8Answers: 0
    edited December 2016

    Okay, I have a nested table, which i populated with data within the main table JS using html DOM coding while the main table is populated with data using AJAX. And now I have the problem that it throws an error: "TypeError: c is undefined" after picking up the right tr with the correct ID code. I suspect I need to generate those tables also dynamically using ajax, but how to do that... Onward searching....

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    If you could post a link to the page showing the issue I'd be happy to take a look. Or use the debug version of the software that is throwing the error and show me the full back trace - that might let me guess what the problem is.

    Allan

  • KimvdLindeKimvdLinde Posts: 30Questions: 8Answers: 0
    edited December 2016

    I send you the link by private as it is a dev site. BTW, DOM generated data and editor incompability is something I found earlier, and we solved it by using ajax data sourcing.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Thanks for the link.

    The issue is with this in the Editor initialisation for the personEditor:

    table: ".peopleMatrix",

    The table option in Editor needs to refer to the specific DataTable that it is going to edit. However, your inner tables are not DataTables, thus the error when it tries to access DataTables information.

    Instead, what you might find easiest here is to use the person Editor as a standalone Editor. It is a little more complex to setup since you need to control the information in the document as well, but I think using inner DataTables for such small tables is going to be really messy!

    Allan

  • KimvdLindeKimvdLinde Posts: 30Questions: 8Answers: 0
    edited December 2016

    At the bottom of the scripts, there is

    var peopleTable = $('.peopleMatrix').DataTable();

    which I believe makes it a DataTables and hence the question remains.

    But I like the standalone editor option and will see what I can get done that way.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Thanks - I did see that, however, my point remains that Editor's table option cannot work with multiple tables. You absolutely can initialise DataTables collectively, but Editor needs to be able to address the table it controls uniquely.

    But I like the standalone editor option and will see what I can get done that way.

    I think that the standalone Editor is the best way of approaching this.

    Allan

This discussion has been closed.