Master-Detail tables pattern suggestions

Master-Detail tables pattern suggestions

fabioberettafabioberetta Posts: 74Questions: 23Answers: 4

Hello,

I need to realize a master-detail pattern to show the following.

Table 1 - Will contain the children of a school
Table 2 - Will contain the parents of the kids of the school

Table 1 will be the master, Table 2 will be the detail table.

I cannot use the master detail pattern for dataTables. So I would like to refresh Table 2 depending on a single row selected in Table 1.

How could I realize it? Do you have an example?

ty
f

This question has an accepted answers - jump to answer

Answers

  • fabioberettafabioberetta Posts: 74Questions: 23Answers: 4

    I actually found a post with a sort of example here.

    https://datatables.net/forums/discussion/26095/full-editor-for-multiple-child-rows

    ty
    f

  • fabioberettafabioberetta Posts: 74Questions: 23Answers: 4

    I have used the example above and it worked nicely. Now I have a subsequent issue I hape someone could suggest a solution.

    Once the child table is filtered I need to edit its content and add new rows.

    Once a row is edited it disappears.

    In the example above a tricj is used to retrieve the filtering key (the id of the master table) to maintain the correct filtering. This does not work for inline editing since the id is not transmitted in the data array.

    The question: is there any way to add to the $_POST load an addition field to be used for filtering? I am thinking to intercept the preSubmit event to add an iddition filed ["filter_id"] coçntainiong the necessary value.

    As standard $_POST contains [action] and [data].

    ty
    f

  • allanallan Posts: 61,667Questions: 1Answers: 10,096 Site admin
    Answer ✓

    Hi,

    Using the preSubmit method sounds like the ideal way of doing it since that is one of the two ways Editor lets you modify the data being sent to the server. The other way is the ajax.data option.

    Allan

  • fabioberettafabioberetta Posts: 74Questions: 23Answers: 4

    Thanks Allan,

    I used the preSubmit event and it worked.

    I think that the ajax.data is better so I will rework the code.

    ty
    f

This discussion has been closed.