Same table size in nested tables












1















I created nested tables (primeNg component) with unknown amout of elements and this is my code:



    <p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th class="is-header">Topic / Comment / Author </th>
<th class="is-header">Points</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr >
<td>{{topic.name}}</td>
<td >{{topic.point}}</td>
</tr>
<td colspan="2">
<p-table *ngIf="topic.commentReports" [value]="topic.commentReports" dataKey="commentName">
<ng-template pTemplate="body" let-comment>
<tr clas="background-color">
<td class="pl-4">{{comment.name}}</td>
<td >{{comment.point}}</td>
</tr>
<td colspan="2">
<p-table *ngIf="comment.authorReports" [value]="comment.authorReports" dataKey="authorName">
<ng-template pTemplate="body" let-author>
<tr *ngIf="author.point > 0" >
<td class="pl-5">{{author.name}}</td>
<td >{{author.point}}</td>
</tr>
</ng-template>
</p-table>
</td>
</ng-template>
</p-table>
</td>
</ng-template>
<ng-template pTemplate="summary">
<div style="text-align: right">
Summary points: {{summaryPoints}}
</div>
</ng-template>
</p-table>


And this how it looks like now:



picture



Like in the picture, nested child table have smaller size than parent.
What I try to do is create maybe some kind of CSS to make them same responsive size.



After discussion with @LGSon I'll provide as much text code as it's possible.
But before I even start I need to tell you, that I used PrimeNg table component, this means you probably cannot run this example without PrimeNg installation



So i updated my html file(by removing all non important parts)



This is my .ts file:



export class TopicComponent implements OnInit {

testCustomerReports: TopicReport = ;
testCommentReports: CommentReport = ;
testAuthorReports: AuthorReport = ;
summaryPoints: number;

constructor() { }

ngOnInit() {
this.summaryPoints = 22;
this.testAuthorReports = [new AuthorReport("Test topic", 22)];
this.testCommentReports = [new CommentReport("Test comment", 22, this.testAuthorReports)];
this.customerReports = [new TopicReport("Test author", 22, this.testCommentReports)];
}
}


Those are my objects:



import { CommentReport } from "./comment-report";

export class AuthorReport {
constructor(
public name: string,
public points: number,
public CommentReports: CommentReport
) { }
}

import { AuthorReport } from "./author-report";

export class CommentReport {
constructor(
public name: string,
public points: number,
public authorReports: AuthorReport
) { }
}

export class AuthorReport {
constructor(
public name: string,
public points: number
) { }
}


My CSS file is clear (totally clear, nothing inside, because all css are probably build-in in p-table component from PrimeNg.



I need to say, that I also tried to inspect by my web browser, but I didn't found anything that could point for any padding property, but I'm not sure if I did it right.
I pressed right on element, than inspect and I was searching for something similar to padding in style view, but didnt found anything. and this is what I found there:



firstsecond



Update 28.11.2018:



Changes suggested by @Kosh Very in his answer made a table look like this:



after suggestion



Now there is a visible table in table in table and I just wanted to make my nested tables to be a row in my first table (like in my first example, but without this indentation).



Second update after comment by @Kosh Very.




Why do I use nested tables?




(I'm not sure if you need to know, but I dont know how many topics are in a table, and I don't know how many comments have single topic, and how many comments have single comment).



I was trying to do it without nested tables as:



<div *ngIf="tableGenerated">
<div class="pt-4">
<p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th class="is-header"> topic / comment / author</th>
<th class="is-header"> points</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr class="background-color">
<td>{{topic.name}}</td>
<td class="is-number">{{topic.point}}</td>
</tr>
<tr class="background-color">
<td>{{topic.commentReports.name}}</td>
<td class="is-number">{{topic.commentReports.point}}</td>
</tr>
<tr class="background-color">
<td>{{topic.commentReports.authorReports.name}}</td>
<td class="is-number">{{topic.commentReports.authorReports.point}}</td>
</tr>
</ng-template>
</p-table>
</div>
</div>


But it seems like I cannot do something like: topic.commentReports.authorReports.point Thats why I made nested tables.










share|improve this question




















  • 1





    Table cells has a default padding that most likely is the reason. If you want a more exact reply, provide the rendered HTML and its CSS as a Minimal, Complete, and Verifiable example, as we can't debug an image.

    – LGSon
    Nov 23 '18 at 19:33













  • @LGSon p-table is angular/primeNg table component and I think html+css won't be enough to just run/debug it.

    – degath
    Nov 23 '18 at 19:42













  • Since your markup will depend on the set CSS, and we can't see that as you didn't post it, it is highly relevant. Did you inspect the rendered result using the browser's dev. tools? ... as that would most likely show what goes on.

    – LGSon
    Nov 23 '18 at 19:46











  • Well CSS is empty (seems like angular/primeNg/p-table has his own CSS, so I think I need to overwrite some CSS properties. But like you offered I investigated column and didnt found anything that could point for some of padding, but its quite good idea. I'll investigate it once again, and I'll take a screenshot. Maybe it will help.

    – degath
    Nov 23 '18 at 19:50






  • 1





    @degath all of the css properties of the table will be available in the front end and can be inspected in the console. Even if no properties are explicitly set there are defaults that are built into the browser.

    – lharby
    Nov 23 '18 at 22:44
















1















I created nested tables (primeNg component) with unknown amout of elements and this is my code:



    <p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th class="is-header">Topic / Comment / Author </th>
<th class="is-header">Points</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr >
<td>{{topic.name}}</td>
<td >{{topic.point}}</td>
</tr>
<td colspan="2">
<p-table *ngIf="topic.commentReports" [value]="topic.commentReports" dataKey="commentName">
<ng-template pTemplate="body" let-comment>
<tr clas="background-color">
<td class="pl-4">{{comment.name}}</td>
<td >{{comment.point}}</td>
</tr>
<td colspan="2">
<p-table *ngIf="comment.authorReports" [value]="comment.authorReports" dataKey="authorName">
<ng-template pTemplate="body" let-author>
<tr *ngIf="author.point > 0" >
<td class="pl-5">{{author.name}}</td>
<td >{{author.point}}</td>
</tr>
</ng-template>
</p-table>
</td>
</ng-template>
</p-table>
</td>
</ng-template>
<ng-template pTemplate="summary">
<div style="text-align: right">
Summary points: {{summaryPoints}}
</div>
</ng-template>
</p-table>


And this how it looks like now:



picture



Like in the picture, nested child table have smaller size than parent.
What I try to do is create maybe some kind of CSS to make them same responsive size.



After discussion with @LGSon I'll provide as much text code as it's possible.
But before I even start I need to tell you, that I used PrimeNg table component, this means you probably cannot run this example without PrimeNg installation



So i updated my html file(by removing all non important parts)



This is my .ts file:



export class TopicComponent implements OnInit {

testCustomerReports: TopicReport = ;
testCommentReports: CommentReport = ;
testAuthorReports: AuthorReport = ;
summaryPoints: number;

constructor() { }

ngOnInit() {
this.summaryPoints = 22;
this.testAuthorReports = [new AuthorReport("Test topic", 22)];
this.testCommentReports = [new CommentReport("Test comment", 22, this.testAuthorReports)];
this.customerReports = [new TopicReport("Test author", 22, this.testCommentReports)];
}
}


Those are my objects:



import { CommentReport } from "./comment-report";

export class AuthorReport {
constructor(
public name: string,
public points: number,
public CommentReports: CommentReport
) { }
}

import { AuthorReport } from "./author-report";

export class CommentReport {
constructor(
public name: string,
public points: number,
public authorReports: AuthorReport
) { }
}

export class AuthorReport {
constructor(
public name: string,
public points: number
) { }
}


My CSS file is clear (totally clear, nothing inside, because all css are probably build-in in p-table component from PrimeNg.



I need to say, that I also tried to inspect by my web browser, but I didn't found anything that could point for any padding property, but I'm not sure if I did it right.
I pressed right on element, than inspect and I was searching for something similar to padding in style view, but didnt found anything. and this is what I found there:



firstsecond



Update 28.11.2018:



Changes suggested by @Kosh Very in his answer made a table look like this:



after suggestion



Now there is a visible table in table in table and I just wanted to make my nested tables to be a row in my first table (like in my first example, but without this indentation).



Second update after comment by @Kosh Very.




Why do I use nested tables?




(I'm not sure if you need to know, but I dont know how many topics are in a table, and I don't know how many comments have single topic, and how many comments have single comment).



I was trying to do it without nested tables as:



<div *ngIf="tableGenerated">
<div class="pt-4">
<p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th class="is-header"> topic / comment / author</th>
<th class="is-header"> points</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr class="background-color">
<td>{{topic.name}}</td>
<td class="is-number">{{topic.point}}</td>
</tr>
<tr class="background-color">
<td>{{topic.commentReports.name}}</td>
<td class="is-number">{{topic.commentReports.point}}</td>
</tr>
<tr class="background-color">
<td>{{topic.commentReports.authorReports.name}}</td>
<td class="is-number">{{topic.commentReports.authorReports.point}}</td>
</tr>
</ng-template>
</p-table>
</div>
</div>


But it seems like I cannot do something like: topic.commentReports.authorReports.point Thats why I made nested tables.










share|improve this question




















  • 1





    Table cells has a default padding that most likely is the reason. If you want a more exact reply, provide the rendered HTML and its CSS as a Minimal, Complete, and Verifiable example, as we can't debug an image.

    – LGSon
    Nov 23 '18 at 19:33













  • @LGSon p-table is angular/primeNg table component and I think html+css won't be enough to just run/debug it.

    – degath
    Nov 23 '18 at 19:42













  • Since your markup will depend on the set CSS, and we can't see that as you didn't post it, it is highly relevant. Did you inspect the rendered result using the browser's dev. tools? ... as that would most likely show what goes on.

    – LGSon
    Nov 23 '18 at 19:46











  • Well CSS is empty (seems like angular/primeNg/p-table has his own CSS, so I think I need to overwrite some CSS properties. But like you offered I investigated column and didnt found anything that could point for some of padding, but its quite good idea. I'll investigate it once again, and I'll take a screenshot. Maybe it will help.

    – degath
    Nov 23 '18 at 19:50






  • 1





    @degath all of the css properties of the table will be available in the front end and can be inspected in the console. Even if no properties are explicitly set there are defaults that are built into the browser.

    – lharby
    Nov 23 '18 at 22:44














1












1








1








I created nested tables (primeNg component) with unknown amout of elements and this is my code:



    <p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th class="is-header">Topic / Comment / Author </th>
<th class="is-header">Points</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr >
<td>{{topic.name}}</td>
<td >{{topic.point}}</td>
</tr>
<td colspan="2">
<p-table *ngIf="topic.commentReports" [value]="topic.commentReports" dataKey="commentName">
<ng-template pTemplate="body" let-comment>
<tr clas="background-color">
<td class="pl-4">{{comment.name}}</td>
<td >{{comment.point}}</td>
</tr>
<td colspan="2">
<p-table *ngIf="comment.authorReports" [value]="comment.authorReports" dataKey="authorName">
<ng-template pTemplate="body" let-author>
<tr *ngIf="author.point > 0" >
<td class="pl-5">{{author.name}}</td>
<td >{{author.point}}</td>
</tr>
</ng-template>
</p-table>
</td>
</ng-template>
</p-table>
</td>
</ng-template>
<ng-template pTemplate="summary">
<div style="text-align: right">
Summary points: {{summaryPoints}}
</div>
</ng-template>
</p-table>


And this how it looks like now:



picture



Like in the picture, nested child table have smaller size than parent.
What I try to do is create maybe some kind of CSS to make them same responsive size.



After discussion with @LGSon I'll provide as much text code as it's possible.
But before I even start I need to tell you, that I used PrimeNg table component, this means you probably cannot run this example without PrimeNg installation



So i updated my html file(by removing all non important parts)



This is my .ts file:



export class TopicComponent implements OnInit {

testCustomerReports: TopicReport = ;
testCommentReports: CommentReport = ;
testAuthorReports: AuthorReport = ;
summaryPoints: number;

constructor() { }

ngOnInit() {
this.summaryPoints = 22;
this.testAuthorReports = [new AuthorReport("Test topic", 22)];
this.testCommentReports = [new CommentReport("Test comment", 22, this.testAuthorReports)];
this.customerReports = [new TopicReport("Test author", 22, this.testCommentReports)];
}
}


Those are my objects:



import { CommentReport } from "./comment-report";

export class AuthorReport {
constructor(
public name: string,
public points: number,
public CommentReports: CommentReport
) { }
}

import { AuthorReport } from "./author-report";

export class CommentReport {
constructor(
public name: string,
public points: number,
public authorReports: AuthorReport
) { }
}

export class AuthorReport {
constructor(
public name: string,
public points: number
) { }
}


My CSS file is clear (totally clear, nothing inside, because all css are probably build-in in p-table component from PrimeNg.



I need to say, that I also tried to inspect by my web browser, but I didn't found anything that could point for any padding property, but I'm not sure if I did it right.
I pressed right on element, than inspect and I was searching for something similar to padding in style view, but didnt found anything. and this is what I found there:



firstsecond



Update 28.11.2018:



Changes suggested by @Kosh Very in his answer made a table look like this:



after suggestion



Now there is a visible table in table in table and I just wanted to make my nested tables to be a row in my first table (like in my first example, but without this indentation).



Second update after comment by @Kosh Very.




Why do I use nested tables?




(I'm not sure if you need to know, but I dont know how many topics are in a table, and I don't know how many comments have single topic, and how many comments have single comment).



I was trying to do it without nested tables as:



<div *ngIf="tableGenerated">
<div class="pt-4">
<p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th class="is-header"> topic / comment / author</th>
<th class="is-header"> points</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr class="background-color">
<td>{{topic.name}}</td>
<td class="is-number">{{topic.point}}</td>
</tr>
<tr class="background-color">
<td>{{topic.commentReports.name}}</td>
<td class="is-number">{{topic.commentReports.point}}</td>
</tr>
<tr class="background-color">
<td>{{topic.commentReports.authorReports.name}}</td>
<td class="is-number">{{topic.commentReports.authorReports.point}}</td>
</tr>
</ng-template>
</p-table>
</div>
</div>


But it seems like I cannot do something like: topic.commentReports.authorReports.point Thats why I made nested tables.










share|improve this question
















I created nested tables (primeNg component) with unknown amout of elements and this is my code:



    <p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th class="is-header">Topic / Comment / Author </th>
<th class="is-header">Points</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr >
<td>{{topic.name}}</td>
<td >{{topic.point}}</td>
</tr>
<td colspan="2">
<p-table *ngIf="topic.commentReports" [value]="topic.commentReports" dataKey="commentName">
<ng-template pTemplate="body" let-comment>
<tr clas="background-color">
<td class="pl-4">{{comment.name}}</td>
<td >{{comment.point}}</td>
</tr>
<td colspan="2">
<p-table *ngIf="comment.authorReports" [value]="comment.authorReports" dataKey="authorName">
<ng-template pTemplate="body" let-author>
<tr *ngIf="author.point > 0" >
<td class="pl-5">{{author.name}}</td>
<td >{{author.point}}</td>
</tr>
</ng-template>
</p-table>
</td>
</ng-template>
</p-table>
</td>
</ng-template>
<ng-template pTemplate="summary">
<div style="text-align: right">
Summary points: {{summaryPoints}}
</div>
</ng-template>
</p-table>


And this how it looks like now:



picture



Like in the picture, nested child table have smaller size than parent.
What I try to do is create maybe some kind of CSS to make them same responsive size.



After discussion with @LGSon I'll provide as much text code as it's possible.
But before I even start I need to tell you, that I used PrimeNg table component, this means you probably cannot run this example without PrimeNg installation



So i updated my html file(by removing all non important parts)



This is my .ts file:



export class TopicComponent implements OnInit {

testCustomerReports: TopicReport = ;
testCommentReports: CommentReport = ;
testAuthorReports: AuthorReport = ;
summaryPoints: number;

constructor() { }

ngOnInit() {
this.summaryPoints = 22;
this.testAuthorReports = [new AuthorReport("Test topic", 22)];
this.testCommentReports = [new CommentReport("Test comment", 22, this.testAuthorReports)];
this.customerReports = [new TopicReport("Test author", 22, this.testCommentReports)];
}
}


Those are my objects:



import { CommentReport } from "./comment-report";

export class AuthorReport {
constructor(
public name: string,
public points: number,
public CommentReports: CommentReport
) { }
}

import { AuthorReport } from "./author-report";

export class CommentReport {
constructor(
public name: string,
public points: number,
public authorReports: AuthorReport
) { }
}

export class AuthorReport {
constructor(
public name: string,
public points: number
) { }
}


My CSS file is clear (totally clear, nothing inside, because all css are probably build-in in p-table component from PrimeNg.



I need to say, that I also tried to inspect by my web browser, but I didn't found anything that could point for any padding property, but I'm not sure if I did it right.
I pressed right on element, than inspect and I was searching for something similar to padding in style view, but didnt found anything. and this is what I found there:



firstsecond



Update 28.11.2018:



Changes suggested by @Kosh Very in his answer made a table look like this:



after suggestion



Now there is a visible table in table in table and I just wanted to make my nested tables to be a row in my first table (like in my first example, but without this indentation).



Second update after comment by @Kosh Very.




Why do I use nested tables?




(I'm not sure if you need to know, but I dont know how many topics are in a table, and I don't know how many comments have single topic, and how many comments have single comment).



I was trying to do it without nested tables as:



<div *ngIf="tableGenerated">
<div class="pt-4">
<p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th class="is-header"> topic / comment / author</th>
<th class="is-header"> points</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr class="background-color">
<td>{{topic.name}}</td>
<td class="is-number">{{topic.point}}</td>
</tr>
<tr class="background-color">
<td>{{topic.commentReports.name}}</td>
<td class="is-number">{{topic.commentReports.point}}</td>
</tr>
<tr class="background-color">
<td>{{topic.commentReports.authorReports.name}}</td>
<td class="is-number">{{topic.commentReports.authorReports.point}}</td>
</tr>
</ng-template>
</p-table>
</div>
</div>


But it seems like I cannot do something like: topic.commentReports.authorReports.point Thats why I made nested tables.







html css angular frontend primeng






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 '18 at 20:55







degath

















asked Nov 21 '18 at 16:17









degathdegath

523722




523722








  • 1





    Table cells has a default padding that most likely is the reason. If you want a more exact reply, provide the rendered HTML and its CSS as a Minimal, Complete, and Verifiable example, as we can't debug an image.

    – LGSon
    Nov 23 '18 at 19:33













  • @LGSon p-table is angular/primeNg table component and I think html+css won't be enough to just run/debug it.

    – degath
    Nov 23 '18 at 19:42













  • Since your markup will depend on the set CSS, and we can't see that as you didn't post it, it is highly relevant. Did you inspect the rendered result using the browser's dev. tools? ... as that would most likely show what goes on.

    – LGSon
    Nov 23 '18 at 19:46











  • Well CSS is empty (seems like angular/primeNg/p-table has his own CSS, so I think I need to overwrite some CSS properties. But like you offered I investigated column and didnt found anything that could point for some of padding, but its quite good idea. I'll investigate it once again, and I'll take a screenshot. Maybe it will help.

    – degath
    Nov 23 '18 at 19:50






  • 1





    @degath all of the css properties of the table will be available in the front end and can be inspected in the console. Even if no properties are explicitly set there are defaults that are built into the browser.

    – lharby
    Nov 23 '18 at 22:44














  • 1





    Table cells has a default padding that most likely is the reason. If you want a more exact reply, provide the rendered HTML and its CSS as a Minimal, Complete, and Verifiable example, as we can't debug an image.

    – LGSon
    Nov 23 '18 at 19:33













  • @LGSon p-table is angular/primeNg table component and I think html+css won't be enough to just run/debug it.

    – degath
    Nov 23 '18 at 19:42













  • Since your markup will depend on the set CSS, and we can't see that as you didn't post it, it is highly relevant. Did you inspect the rendered result using the browser's dev. tools? ... as that would most likely show what goes on.

    – LGSon
    Nov 23 '18 at 19:46











  • Well CSS is empty (seems like angular/primeNg/p-table has his own CSS, so I think I need to overwrite some CSS properties. But like you offered I investigated column and didnt found anything that could point for some of padding, but its quite good idea. I'll investigate it once again, and I'll take a screenshot. Maybe it will help.

    – degath
    Nov 23 '18 at 19:50






  • 1





    @degath all of the css properties of the table will be available in the front end and can be inspected in the console. Even if no properties are explicitly set there are defaults that are built into the browser.

    – lharby
    Nov 23 '18 at 22:44








1




1





Table cells has a default padding that most likely is the reason. If you want a more exact reply, provide the rendered HTML and its CSS as a Minimal, Complete, and Verifiable example, as we can't debug an image.

– LGSon
Nov 23 '18 at 19:33







Table cells has a default padding that most likely is the reason. If you want a more exact reply, provide the rendered HTML and its CSS as a Minimal, Complete, and Verifiable example, as we can't debug an image.

– LGSon
Nov 23 '18 at 19:33















@LGSon p-table is angular/primeNg table component and I think html+css won't be enough to just run/debug it.

– degath
Nov 23 '18 at 19:42







@LGSon p-table is angular/primeNg table component and I think html+css won't be enough to just run/debug it.

– degath
Nov 23 '18 at 19:42















Since your markup will depend on the set CSS, and we can't see that as you didn't post it, it is highly relevant. Did you inspect the rendered result using the browser's dev. tools? ... as that would most likely show what goes on.

– LGSon
Nov 23 '18 at 19:46





Since your markup will depend on the set CSS, and we can't see that as you didn't post it, it is highly relevant. Did you inspect the rendered result using the browser's dev. tools? ... as that would most likely show what goes on.

– LGSon
Nov 23 '18 at 19:46













Well CSS is empty (seems like angular/primeNg/p-table has his own CSS, so I think I need to overwrite some CSS properties. But like you offered I investigated column and didnt found anything that could point for some of padding, but its quite good idea. I'll investigate it once again, and I'll take a screenshot. Maybe it will help.

– degath
Nov 23 '18 at 19:50





Well CSS is empty (seems like angular/primeNg/p-table has his own CSS, so I think I need to overwrite some CSS properties. But like you offered I investigated column and didnt found anything that could point for some of padding, but its quite good idea. I'll investigate it once again, and I'll take a screenshot. Maybe it will help.

– degath
Nov 23 '18 at 19:50




1




1





@degath all of the css properties of the table will be available in the front end and can be inspected in the console. Even if no properties are explicitly set there are defaults that are built into the browser.

– lharby
Nov 23 '18 at 22:44





@degath all of the css properties of the table will be available in the front end and can be inspected in the console. Even if no properties are explicitly set there are defaults that are built into the browser.

– lharby
Nov 23 '18 at 22:44












1 Answer
1






active

oldest

votes


















2





+50









Your template code is incorrect:

HTML table cells <td> need to be placed into rows <tr>, but you missed some.



Also, you cannot place <div> into <table> directly.

So you need to wrap it into a cell, then wrap the cell into a row, and then place the row into the table.



Final solution found by @degath:



<p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th>task / comment / author</th>
<th>points </th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr class="background-color">
<td>{{topic.name}}</td>
<td class="is-number">{{topic.workedHour}}</td>
</tr>
<ng-template ngFor let-comment [ngForOf]="topic.commentReports">
<tr class="background-color">
<td class="pl-4">{{comment.name}}</td>
<td class="is-number">{{comment.workedHour}}</td>
</tr>
<ng-template ngFor let-author [ngForOf]="comment.authorReports">
<tr class="background-color">
<td class="pl-4">{{author.name}}</td>
<td class="is-number">{{author.workedHour}}</td>
</tr>
</ng-template>
</ng-template>
</ng-template>
</p-table>





share|improve this answer


























  • first of all, thanks for your time! I updated a question for you.

    – degath
    Nov 28 '18 at 19:03











  • @degath, thank you for the update! So why don't you just remove the nested tables?

    – Kosh Very
    Nov 28 '18 at 19:10











  • Good question! I'll answer my question once again.

    – degath
    Nov 28 '18 at 19:17











  • @degath, I've updated my answer with the flattened template.

    – Kosh Very
    Nov 28 '18 at 19:21











  • I updated my answer, but it looks like you're reading in my mind. I think that you already made my day.... It looks like it's what I'm looking for. I'll accept the answer ASAP if it will work like expected.

    – degath
    Nov 28 '18 at 19:23











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416317%2fsame-table-size-in-nested-tables%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2





+50









Your template code is incorrect:

HTML table cells <td> need to be placed into rows <tr>, but you missed some.



Also, you cannot place <div> into <table> directly.

So you need to wrap it into a cell, then wrap the cell into a row, and then place the row into the table.



Final solution found by @degath:



<p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th>task / comment / author</th>
<th>points </th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr class="background-color">
<td>{{topic.name}}</td>
<td class="is-number">{{topic.workedHour}}</td>
</tr>
<ng-template ngFor let-comment [ngForOf]="topic.commentReports">
<tr class="background-color">
<td class="pl-4">{{comment.name}}</td>
<td class="is-number">{{comment.workedHour}}</td>
</tr>
<ng-template ngFor let-author [ngForOf]="comment.authorReports">
<tr class="background-color">
<td class="pl-4">{{author.name}}</td>
<td class="is-number">{{author.workedHour}}</td>
</tr>
</ng-template>
</ng-template>
</ng-template>
</p-table>





share|improve this answer


























  • first of all, thanks for your time! I updated a question for you.

    – degath
    Nov 28 '18 at 19:03











  • @degath, thank you for the update! So why don't you just remove the nested tables?

    – Kosh Very
    Nov 28 '18 at 19:10











  • Good question! I'll answer my question once again.

    – degath
    Nov 28 '18 at 19:17











  • @degath, I've updated my answer with the flattened template.

    – Kosh Very
    Nov 28 '18 at 19:21











  • I updated my answer, but it looks like you're reading in my mind. I think that you already made my day.... It looks like it's what I'm looking for. I'll accept the answer ASAP if it will work like expected.

    – degath
    Nov 28 '18 at 19:23
















2





+50









Your template code is incorrect:

HTML table cells <td> need to be placed into rows <tr>, but you missed some.



Also, you cannot place <div> into <table> directly.

So you need to wrap it into a cell, then wrap the cell into a row, and then place the row into the table.



Final solution found by @degath:



<p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th>task / comment / author</th>
<th>points </th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr class="background-color">
<td>{{topic.name}}</td>
<td class="is-number">{{topic.workedHour}}</td>
</tr>
<ng-template ngFor let-comment [ngForOf]="topic.commentReports">
<tr class="background-color">
<td class="pl-4">{{comment.name}}</td>
<td class="is-number">{{comment.workedHour}}</td>
</tr>
<ng-template ngFor let-author [ngForOf]="comment.authorReports">
<tr class="background-color">
<td class="pl-4">{{author.name}}</td>
<td class="is-number">{{author.workedHour}}</td>
</tr>
</ng-template>
</ng-template>
</ng-template>
</p-table>





share|improve this answer


























  • first of all, thanks for your time! I updated a question for you.

    – degath
    Nov 28 '18 at 19:03











  • @degath, thank you for the update! So why don't you just remove the nested tables?

    – Kosh Very
    Nov 28 '18 at 19:10











  • Good question! I'll answer my question once again.

    – degath
    Nov 28 '18 at 19:17











  • @degath, I've updated my answer with the flattened template.

    – Kosh Very
    Nov 28 '18 at 19:21











  • I updated my answer, but it looks like you're reading in my mind. I think that you already made my day.... It looks like it's what I'm looking for. I'll accept the answer ASAP if it will work like expected.

    – degath
    Nov 28 '18 at 19:23














2





+50







2





+50



2




+50





Your template code is incorrect:

HTML table cells <td> need to be placed into rows <tr>, but you missed some.



Also, you cannot place <div> into <table> directly.

So you need to wrap it into a cell, then wrap the cell into a row, and then place the row into the table.



Final solution found by @degath:



<p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th>task / comment / author</th>
<th>points </th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr class="background-color">
<td>{{topic.name}}</td>
<td class="is-number">{{topic.workedHour}}</td>
</tr>
<ng-template ngFor let-comment [ngForOf]="topic.commentReports">
<tr class="background-color">
<td class="pl-4">{{comment.name}}</td>
<td class="is-number">{{comment.workedHour}}</td>
</tr>
<ng-template ngFor let-author [ngForOf]="comment.authorReports">
<tr class="background-color">
<td class="pl-4">{{author.name}}</td>
<td class="is-number">{{author.workedHour}}</td>
</tr>
</ng-template>
</ng-template>
</ng-template>
</p-table>





share|improve this answer















Your template code is incorrect:

HTML table cells <td> need to be placed into rows <tr>, but you missed some.



Also, you cannot place <div> into <table> directly.

So you need to wrap it into a cell, then wrap the cell into a row, and then place the row into the table.



Final solution found by @degath:



<p-table [value]="topicReports" dataKey="topicName">
<ng-template pTemplate="header">
<tr>
<th>task / comment / author</th>
<th>points </th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-topic>
<tr class="background-color">
<td>{{topic.name}}</td>
<td class="is-number">{{topic.workedHour}}</td>
</tr>
<ng-template ngFor let-comment [ngForOf]="topic.commentReports">
<tr class="background-color">
<td class="pl-4">{{comment.name}}</td>
<td class="is-number">{{comment.workedHour}}</td>
</tr>
<ng-template ngFor let-author [ngForOf]="comment.authorReports">
<tr class="background-color">
<td class="pl-4">{{author.name}}</td>
<td class="is-number">{{author.workedHour}}</td>
</tr>
</ng-template>
</ng-template>
</ng-template>
</p-table>






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 28 '18 at 21:30

























answered Nov 28 '18 at 16:52









Kosh VeryKosh Very

11k1926




11k1926













  • first of all, thanks for your time! I updated a question for you.

    – degath
    Nov 28 '18 at 19:03











  • @degath, thank you for the update! So why don't you just remove the nested tables?

    – Kosh Very
    Nov 28 '18 at 19:10











  • Good question! I'll answer my question once again.

    – degath
    Nov 28 '18 at 19:17











  • @degath, I've updated my answer with the flattened template.

    – Kosh Very
    Nov 28 '18 at 19:21











  • I updated my answer, but it looks like you're reading in my mind. I think that you already made my day.... It looks like it's what I'm looking for. I'll accept the answer ASAP if it will work like expected.

    – degath
    Nov 28 '18 at 19:23



















  • first of all, thanks for your time! I updated a question for you.

    – degath
    Nov 28 '18 at 19:03











  • @degath, thank you for the update! So why don't you just remove the nested tables?

    – Kosh Very
    Nov 28 '18 at 19:10











  • Good question! I'll answer my question once again.

    – degath
    Nov 28 '18 at 19:17











  • @degath, I've updated my answer with the flattened template.

    – Kosh Very
    Nov 28 '18 at 19:21











  • I updated my answer, but it looks like you're reading in my mind. I think that you already made my day.... It looks like it's what I'm looking for. I'll accept the answer ASAP if it will work like expected.

    – degath
    Nov 28 '18 at 19:23

















first of all, thanks for your time! I updated a question for you.

– degath
Nov 28 '18 at 19:03





first of all, thanks for your time! I updated a question for you.

– degath
Nov 28 '18 at 19:03













@degath, thank you for the update! So why don't you just remove the nested tables?

– Kosh Very
Nov 28 '18 at 19:10





@degath, thank you for the update! So why don't you just remove the nested tables?

– Kosh Very
Nov 28 '18 at 19:10













Good question! I'll answer my question once again.

– degath
Nov 28 '18 at 19:17





Good question! I'll answer my question once again.

– degath
Nov 28 '18 at 19:17













@degath, I've updated my answer with the flattened template.

– Kosh Very
Nov 28 '18 at 19:21





@degath, I've updated my answer with the flattened template.

– Kosh Very
Nov 28 '18 at 19:21













I updated my answer, but it looks like you're reading in my mind. I think that you already made my day.... It looks like it's what I'm looking for. I'll accept the answer ASAP if it will work like expected.

– degath
Nov 28 '18 at 19:23





I updated my answer, but it looks like you're reading in my mind. I think that you already made my day.... It looks like it's what I'm looking for. I'll accept the answer ASAP if it will work like expected.

– degath
Nov 28 '18 at 19:23




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416317%2fsame-table-size-in-nested-tables%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)