multiple rows per record

multiple rows per record

hogookhwanhogookhwan Posts: 3Questions: 1Answers: 0

I want to show a lot of information on one table.
So I want to show a record in two lines.
Please help me what to do.

Answers

  • colincolin Posts: 12,657Questions: 0Answers: 2,163

    Hi @hogookhwan ,

    Probably the easiest way would be to use child rows, see example here, where the child row is always displayed (you can open them all in initComplete. The child row can be formatted anyway you like, so you could just make it look like another row in the table.

    Cheers,

    Colin

  • hogookhwanhogookhwan Posts: 3Questions: 1Answers: 0

    thank you for the reply.
    But child rows is different from the screen that the customer wants (the image I attached).
    Is there no other way?

  • kthorngrenkthorngren Posts: 13,816Questions: 25Answers: 3,252
    edited July 2019

    As Colin mentioned child rows is would be the easiest. Allan's answer in this thread shows how to create an additional child row that aligns with the original row. I updated one of my examples to show how this could be done:
    http://live.datatables.net/ralakoru/1/edit

    Hopefully this will get you started. You will need to workout how to display the first and last columns the way you want. It uses rows().every() to loop through all the rows. note also I commented out the details-control class to keep from displaying the plus.

    Kevin

  • hogookhwanhogookhwan Posts: 3Questions: 1Answers: 0
    edited July 2019

    thank you for the reply.

    I implemented it using the initcomplete you recommended.
    However, if the page changes, initcomplete is not called, so only one line of data is displayed.
    Is there anything I'm missing?

  • colincolin Posts: 12,657Questions: 0Answers: 2,163

    initComplete is only called once, after the table has initialised. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • kthorngrenkthorngren Posts: 13,816Questions: 25Answers: 3,252

    If you are using server side processing then you will probably need to use drawCallback instead of initComplete. The reason is that only the current page resides in the client.

    If you are not using server side processing then, as Colin mentioned, we will need a test case to see what is wrong.

    Kevin

  • bretz032bretz032 Posts: 1Questions: 0Answers: 0

    were you able to find a solution for this?

  • allanallan Posts: 54,716Questions: 1Answers: 8,560 Site admin

    Does Kevin's solution from above not do what you need?

    Allan

Sign In or Register to comment.