Relations in a child row

Relations in a child row

growinupgrowinup Posts: 2Questions: 1Answers: 0
edited April 2022 in DataTables

Hi,
I wonder how could use the relation data I get from the server, in a child row.
And also if its possible to include that relation in the search or filter. For example to search all the invoices by date
Here's an example of the data I'd like to use.
thanks so much

{
    "data": [{
        "id": "1",
        "name": "Test",
        "invoices": [{
                "id": "123",
                "date": "2011/04/25"
            },
            {
                "id": "124",
                "date": "2012/04/25"
            },
            {
                "id": "125",
                "date": "2013/04/25"
            }
        ]
    }]
}

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    You could create a DataTable within the child row, as in this example from this thread, and keep search on that child table. Is that the kind of thing you're after?

    Colin

  • growinupgrowinup Posts: 2Questions: 1Answers: 0

    Hi Colin,
    Thanks for your message.
    I'd need to have an input search box to search by the invoices date or invoices id, but these fields are in an array. If I put the invoices array in a hidden column, for example, show should I create the filter or search?
    thanks again

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    You can use the DataTables search - see my last example here but with the dom commented out so it gets the full set of controls.

    Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Cheers,

    Colin

Sign In or Register to comment.