3

I have a set of rows I am displaying via jQuery datatables , basically using a grid list in MVC ASP.net and then using jQuery datatables to expand each row of data to show new table data. The detail table data does not occupy the full width of the row and shows up like this

Table example

My call to open table function is

oTable.fnOpen(nTr, details, 'LP')

where LP is the styling class of the parent table as seen in the figure, but it is not being applied. Ive tried applying the styling to the HTML itself of the detail rows but to no avail How do I make it take the styling of the parent table and occupy the width of the parent table?

ANSWER:

It turns out my sortable columns in the parent table were preventing the styling from working with the child tables - I havent studied enough to learn why yet, but something as a reference to anyone with the problem. Putting a sort on all columns of the parent table and changing the styling of the child to include 100% width worked.

2 Answers 2

1
+50

I coded this Plunker which is derived from the dataTables examples.

subtables

It seems to do what you wanted. (Ignore the broken icons, plz).

Since I don't know any of your code I had to construct this lengthy script. But in fact it comes down to simply adding a width of 100% to your subtable (line 4 of plunker code):

 var sOut = '<table class="subtable" style="width:100%">';

Please check this out and use my plunker as a base for further refinements that can be discussed here. (Others might be of help too, if you show them some of your code).

Hope this helps. (Btw, very nice fjords!)

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, This helped me to get to the answer in my case, though my case was specific, this post helps me, so awarding the bounty
@mainguy Could you pelase hav e look at Cannot list details data in jQuery Datatable? Thanks in advance...
0

This may be completely useless, but I ran into a very similar issue with datatables and the problem was the table's css display property was set to 'block'. Once removed, no problem. On the off chance yours is doing that, I thought I'd post.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.