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: 15,112Questions: 1Answers: 2,583

    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: 20,139Questions: 26Answers: 4,735
    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: 15,112Questions: 1Answers: 2,583

    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: 20,139Questions: 26Answers: 4,735

    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: 61,433Questions: 1Answers: 10,049 Site admin

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

    Allan

  • bonaventurebonaventure Posts: 12Questions: 5Answers: 0

    such a pity that all the testcases are gone ...

  • kthorngrenkthorngren Posts: 20,139Questions: 26Answers: 4,735

    @bonaventure The test cases are still there such as this one:
    http://live.datatables.net/ralakoru/1/edit

    Others have gotten 404 errors with the http://live.datatables.net examples. I believe these are browser issues. Try clearing your cache or use a different browser.

    Kevin

Sign In or Register to comment.