First line in with Row Details.
First line in with Row Details.
ilam
Posts: 9Questions: 3Answers: 0
Hi,
I use http://datatables.net/examples/api/row_details.html
I shall like that the first line is show when the page displays. I try to use
table.row( ':eq(0)' ).child( [
'First child row',
'Second child row',
'Third child row'
] )
.show();
to activate the first line but it does not work.
Anybody can help me?
Thx,
This discussion has been closed.
Answers
Hi,
That looks like it should work to me. Can you link to a test page showing the problem so I can debug it please?
Allan
Hi Allan,
This is the code to debug: http://live.datatables.net/jomeqena/1/
The same that http://datatables.net/examples/api/row_details.html , I just add
I have probleme to add ajax data with the live.datatables.net: there are only HTML, JS, CSS and console but not ajax.
So this is the ajax data (objetcs.txt):
I want to display the first line (or first two) with an expand first row; + column would be activated immediately upon posting of the first line (or first two lines).
I add
in JS but i think that i make a mistake.
Can you help me?
Thx,
I get errors when trying to use that test case ( http://live.datatables.net/jomeqena/2/edit ).
Perhaps I should have qualify my statement with, can you link to a live and working test case showing the problem rather than just the code. I will debug the code later on today if I have time, but I don't have a huge amount of spare time at the moment.
Having said that, the one thing that immediately stands out for me, when scanning the code is that you are Ajax loading the data, but not waiting for the data to be loaded before trying to open the first row. Use
initComplete
for that.Allan
Hi Allan, sorry for the delay,
I think that my explanations were not clear. and I have difficulty in using the live datatables.
I use Child rows, I take the same for the example: http://www.datatables.net/examples/api/row_details.html
We have the result 1 when the web page loads,
I try to obtain the result 2.
What script has to I use? And where I have to place it?
Thank you;
Result 1 (We have this result 1):
Result 2 (I try to obtain this result 2.):
If you want only one row "open" at a time, you will need to loop over all other rows (using
rows().indexes()
) and check if they are open or not (row().child.isShown()
). If it is, close it.Another option is to use a local variable to keep track of the open row and close if it required.
Allan