multiple rows per record
multiple rows per record
hogookhwan
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
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
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?
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 thedetails-control
class to keep from displaying the plus.Kevin
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?
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
If you are using server side processing then you will probably need to use
drawCallback
instead ofinitComplete
. 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
were you able to find a solution for this?
Does Kevin's solution from above not do what you need?
Allan
such a pity that all the testcases are gone ...
@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