table content are exceeding in Card - html

Would like to ask if there is a solution for this. The table contents are exceeding in card. See screenshot below:
However, if I un-collapse the sidebar the view is fine. See screenshot below
Some of the page links are fine. some are not. Here is my code for td
#foreach($mfo as $row)
<tr style="font-size: 10.5pt;">
<td style="overflow-wrap: break-word;">{{$row->form_type}}</td>
<td style="overflow-wrap: break-word;">{{$row->dept_name}}</td>
<td style="overflow-wrap: break-word;">{{$row->function_name}}</td>
<td style="overflow-wrap: break-word;">{{$row->role}}</td>
<td style="overflow-wrap: break-word;">{!! $row->mfo_desc !!}</td>
<td style="overflow-wrap: break-word;">{!! $row->success_indicator_desc !!}</td>
<td>{!! $row->remarks !!}
<td>
Edit
<a href="#" class="btn btn-danger btn-sm"
data-mymfoid="{{$row->id}}" data-toggle="modal" data-target="#deletemfo">Delete</a>
</td>
</tr>
#endforeach

It's simply too much text in your table.
A wider screen could solve the issue (if you haven't got a max-width on the table or parent container).
If you can shorten the text in the table head that could help.
You might be able to decrease your font size as well.

Here is the solution on how I fixed it. However, I think it is not based on a good practice.
<table class="table table-striped" style="width: 100%; table-layout: fixed;">
<thead>
<tr>
<th style="width: 7%;">FORM TYPE</th>
<th style="width: 10%">DEPT NAME</th>
<th style="width: 13%;">FUNCTION NAME</th>
<th style="width: 10%;">ROLE NAME</th>
<th style="width: 20%">ORGANIZATIONAL OUTCOMES/KEY RESULTS AREA</th>
<th style="width: 20%">QUALITY + OBJECTIVES
(TARGETS + MEASURES)</th>
<th style="width: 20%">REMARKS</th>
<th style="width: 10%">ACTIONS</th>
</tr>
</thead>
<tbody>
#foreach($mfo as $row)
<tr style="font-size: 10.5pt;">
<td style="overflow-wrap: break-word;">{{$row->form_type}}</td>
<td style="overflow-wrap: break-word;">{{$row->dept_name}}</td>
<td style="overflow-wrap: break-word;">{{$row->function_name}}</td>
<td style="overflow-wrap: break-word;">{{$row->role}}</td>
<td style="overflow-wrap: break-word;">{!! $row->mfo_desc !!}</td>
<td style="overflow-wrap: break-word;">{!! $row->success_indicator_desc !!}</td>
<td>{!! $row->remarks !!}
<td>
Edit
<a href="#" class="btn btn-danger btn-sm"
data-mymfoid="{{$row->id}}" data-toggle="modal" data-target="#deletemfo">Delete</a>
</td>
</tr>
#endforeach
</tbody>
</table>
Notes:
In table class, I added a width=100%; table-layout: fixed;
Fixed width for each tag with a total of 110%

Related

css issue table design

please can you help me to fix the design to make data more clear ,i will be very grateful if you help me ,thanks for your answer in advance
this is my css file
table-layout: fixed;
width: 100%;
border-collapse: collapse;
table-layout: fixed;
overflow: hidden;
}
this is my html file
<div class="col-md-12">
<div class="table-wrap">
<table class="table table-striped" >
<thead>
<tr>
<th class="odd" colspan="4">id</th>
<th class="odd" colspan="4">name</th>
<th *ngIf="isAdmin()" class="odd" colspan="4"> password</th>
<th class="odd" colspan="4">role</th>
<th class="odd" colspan="4"class="corner wideRow">email</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let el of users | paginate: { itemsPerPage: 2, currentPage: p }">
<th class="odd" colspan="4" ></th>
<td class="odd" colspan="4" >{{el.id}} </td>
<td class="odd" colspan="4" >{{el.username}}</td>
<td *ngIf="isAdmin()" class="odd" colspan="4">{{el.password}}</td>
<td class="odd" colspan="4" >{{el.role}}</td>
<td class="odd" colspan="4" >{{el.email}}</td>
<td class="odd" colspan="4">
<tr>
<a *ngIf="isAdmin()"
class="btn btn-danger" (click) = "deleteUser(el.id)" >Delete</a>
<a *ngIf="isAdmin()" class="btn btn-success" data-original-title="Edit">Edit</a>
</tr>
</td>
</tbody>
</table>
</div>
</div>
</div>
<pagination-controls (pageChange)="p = $event"></pagination-controls>
this the result ,it's not clear and i didn't khnow how to fixed it
when i add in csstable td { word-break: break-all;
}**
the result
result 2
1.) Having colspan="4" in each cell does not make any sense.
2.) The first (empty) th element in the tbody rows causes the misaligning you wrote about. Erase that to have IDs under the "id" header, names under the "name" header etc.
3.) You need an additional th cell in the header row (at the end) to have the same amount of cells as in the rows below it (above the cells with the nested tables which contain the two buttons).
.table-striped {
width: 100%;
border-collapse: collapse;
}
table td {
border: 1px solid #ddd;
word-break: break-all;
}
<table class="table table-striped">
<thead>
<tr>
<th class="odd">id</th>
<th class="odd">name</th>
<th *ngIf="isAdmin()" class="odd"> password</th>
<th class="odd">role</th>
<th class="odd">email</th>
<th class="odd"></th>
<th></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let el of users | paginate: { itemsPerPage: 2, currentPage: p }">
<td class="odd">{{el.id}} </td>
<td class="odd">{{el.username}}</td>
<td *ngIf="isAdmin()" class="odd">{{el.password}}</td>
<td class="odd">{{el.role}}</td>
<td class="odd">{{el.email}}</td>
<td>
<table>
<tr>
<td>
<a *ngIf="isAdmin()" class="btn btn-danger" (click)="deleteUser(el.id)">Delete</a>
</td>
<td>
<a *ngIf="isAdmin()" class="btn btn-success" data-original-title="Edit">Edit</a>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
Add this css
table td {
word-break: break-all;
}
And use this corrected html. Make sure you header columns and body columns are equals.
<div class="col-md-12">
<div class="table-wrap">
<table class="table table-striped">
<thead>
<tr>
<th class="odd" colspan="4">id</th>
<th class="odd" colspan="4">name</th>
<th *ngIf="isAdmin()" class="odd" colspan="4"> password</th>
<th class="odd" colspan="4">role</th>
<th class="odd" colspan="4">email</th>
<th class="odd" colspan="4"></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let el of users | paginate: { itemsPerPage: 2, currentPage: p }">
<td class="odd" colspan="4">{{el.id}} </td>
<td class="odd" colspan="4">{{el.username}}</td>
<td *ngIf="isAdmin()" class="odd" colspan="4">{{el.password}}</td>
<td class="odd" colspan="4">{{el.role}}</td>
<td class="odd" colspan="4">{{el.email}}</td>
<td>
<table>
<tr>
<td>
<a *ngIf="isAdmin()" class="btn btn-danger" (click)="deleteUser(el.id)">Delete</a>
</td>
<td>
<a *ngIf="isAdmin()" class="btn btn-success" data-original-title="Edit">Edit</a>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>

Not able to properly align table in Angular 2 - unwanted white space to the right

I am making a table in Angular 2. I have 4 columns, but after the last column unwanted white space to the right. I am using bootstrap as well.
The below given is the HTML class
<div class="panel panel-default">
<div class="panel-heading">User information</div>
<div class = 'data-table'>
<table style="width:60px" class="text-center" header-class="'text-center'" class="table table-bordered" [mfData]="data" #mf="mfDataTable" [mfRowsOnPage]="10">
<thead>
<tr>
<th style="width: 10%"></th>
<th style="width: 10%">
<mfDefaultSorter by="name">Name</mfDefaultSorter>
</th>
<th style="width: 10%">
<mfDefaultSorter by="email">Email</mfDefaultSorter>
</th>
<th style="width: 10%">
<mfDefaultSorter by="age">Age</mfDefaultSorter>
</th>
<th style="width: 10%">
<mfDefaultSorter by="city">City</mfDefaultSorter>
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of mf.data">
<td>
<button class="btn btn-danger" title="remove">
<span class="glyphicon glyphicon-remove"></span>
</button>
</td>
<td>"AJ"</td>
<td>"AJ"</td>
<td class="text-right">"AJ"</td>
<td>"AJ"</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<mfBootstrapPaginator [rowsOnPageSet]="[5,10,15]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
Please see the screenshot of the page:
As denoted in the screenshot, I have marked in yellow the white space to the right and a small column like space at the bottom. how to remove those to get a proper table?
You are using 60px width and 10% on each <th> try to change this to 100% width and 20% on each cell.
<div class="panel panel-default">
<div class="panel-heading">User information</div>
<div class = 'data-table'>
<table style="width:100%" class="text-center" header-class="'text-center'" class="table table-bordered" [mfData]="data" #mf="mfDataTable" [mfRowsOnPage]="10">
<thead>
<tr>
<th style="width: 20%"></th>
<th style="width: 20%">
<mfDefaultSorter by="name">Name</mfDefaultSorter>
</th>
<th style="width: 20%">
<mfDefaultSorter by="email">Email</mfDefaultSorter>
</th>
<th style="width: 20%">
<mfDefaultSorter by="age">Age</mfDefaultSorter>
</th>
<th style="width: 20%">
<mfDefaultSorter by="city">City</mfDefaultSorter>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3">
<mfBootstrapPaginator [rowsOnPageSet]="[5,10,15]"></mfBootstrapPaginator>
</td>
</tr>
</tfoot>
<tbody>
<tr *ngFor="let item of mf.data">
<td>
<button class="btn btn-danger" title="remove">
<span class="glyphicon glyphicon-remove"></span>
</button>
</td>
<td>"AJ"</td>
<td>"AJ"</td>
<td class="text-right">"AJ"</td>
<td>"AJ"</td>
</tr>
</tbody>
</table>
</div>
</div>

How to fix the div aligning inside <table>

How can I have align Name with title/phone/email and when I expand my page the aligning is messing up as shown in screen shot 1 and 2
I have tried: style="display:initial;position: relative; "
but does not do any good.
<table class="detailList" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="data2Col first " colspan="2">
<div>
<span class="labelCol vfLabelColTextWrap" scope="row" style="display:inline-block; ">Name </span>
<span class="data2Col"> Erich Schulz </span>
</div>
</td>
</tr>
<tr>
<th class="labelCol vfLabelColTextWrap " scope="row">Title</th>
<td class="data2Col "><span id="j_id0:j_id1:j_id3:j_id4:j_id6"></span></td>
</tr>
<tr>
<th class="labelCol vfLabelColTextWrap " scope="row">Phone</th>
<td class="data2Col "><span id="j_id0:j_id1:j_id3:j_id4:j_id7">(555) 555-5555</span></td>
</tr>
<tr>
<th class="labelCol vfLabelColTextWrap last " scope="row">Email</th>
<td class="data2Col last "><span id="j_id0:j_id1:j_id3:j_id4:j_id8">test#example.com</span></td>
</tr>
</tbody>
</table>
Try replacing both span elements with th and td
<span class="labelCol vfLabelColTextWrap" scope="row" style="display:inline-block; ">Name </span>
<span class="data2Col"> Erich Schulz </span>
Shown below:
<th class="labelCol vfLabelColTextWrap " scope="row">Name </th>
<td class="data2Col"> Erich Schulz </td>
As written in my comment, I would replace the span elements in the first table row by td elements (and remove the colspan=2 from that row):
<table class="detailList" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="data2Col first ">
<div>
<td class="labelCol vfLabelColTextWrap" scope="row" style="display:inline-block; ">Name </td>
<td class="data2Col"> Erich Schulz </td>
</div>
</td>
</tr>
<tr>
<th class="labelCol vfLabelColTextWrap " scope="row">Title</th>
<td class="data2Col "><span id="j_id0:j_id1:j_id3:j_id4:j_id6"></span></td>
</tr>
<tr>
<th class="labelCol vfLabelColTextWrap " scope="row">Phone</th>
<td class="data2Col "><span id="j_id0:j_id1:j_id3:j_id4:j_id7">(555) 555-5555</span></td>
</tr>
<tr>
<th class="labelCol vfLabelColTextWrap last " scope="row">Email</th>
<td class="data2Col last "><span id="j_id0:j_id1:j_id3:j_id4:j_id8">test#example.com</span></td>
</tr>
</tbody>
</table>
Or, if for some reason you have to keep those span elements, wrap them with <td>...</td>
Additional edit: As spencerlarry wrote correctly, the first one is actually a <th> tag. But that probably won't make a difference regarding the alignment.
Why do you use the first column in one piece? Please change the first <tr> block as follows:
<tr>
<td class="labelCol first">
<span class="vfLabelColTextWrap" scope="row">Name </span>
</td>
<td class="data2Col">
Erich Schulz
</td>
</tr>

setting bootstrap table going outside accordion

I have one HTML table which I have kept in bootstrap's accordion, I am taking the input from user, whenever input is too long table is getting outside accordion. How can I set width the fixed, and let it expand vertically.
<table id="recordTable" class="table table-bordered table-striped">
<thead>
<tr>
<th class="col-md-1">Question Number</th>
<th class="col-md-6">Question Text</th>
<th class="col-md-3">upload Document(if any)</th>
<th class="col-md-1">Document uploaded?</th>
<th class="col-md-1">Delete</th>
</tr>
</thead>
<tbody>
<tr>
<td class="ques_id col-md-1">12 </td>
<td class="ques_text col-md-6">asd</td>
<td class="ques_file col-md-3"><input type="file" name="supportingDocument" accept="application/pdf" id="uploadSupportingDoc"></td>
<td class="fileuploadSuccess col-md-1"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></td>
<td class="col-md-1">delete</td>
</tr>
<tr>
<td class="ques_id col-md-1">14 </td>
<td class="ques_text col-md-6">asd</td>
<td class="ques_file col-md-3"><input type="file" name="supportingDocument" accept="application/pdf" id="uploadSupportingDoc"></td>
<td class="fileuploadSuccess col-md-1"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></td>
<td class="col-md-1">delete</td>
</tr><tr><td class="ques_id">15</td><td class="ques_text">sdfdfgdfgaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</td><td class="ques_file"><input type="file" name="supportingDocument" accept="application/pdf" id="uploadSupportingDoc"></td><td class="fileuploadSuccess"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></td><td>delete</td></tr>
</tbody>
</table>
Here is screenshot of the image.
jsfiddle link: https://jsfiddle.net/govi20/obnpjt7h/
add this property word-break: break-all; to td tag
another way add class to table outer element table-responsive
<div class="table-responsive">
<table class="table table-bordered table-striped">
...
</table>
</div>
https://jsfiddle.net/obnpjt7h/1/

Thymeleaf th unless

in my html i wanna use "th:unless". i wanna compare two coming variable,if any one match with other, i want to hide the button in that raw.
here is my code..
Art-in-Nisantasi-Id
Art-in-Nisantasi-Text
Art-in-Nisantasi-Url
Art-in-Nisantasi-Coordinate
<h3>All Contents</h3>
<table border="1">
<tr align="left">
<th style="width: 20px;">Art-in-Nisantasi-Id</th>
<th style="width: 100px;">Art-in-Nisantasi-Text</th>
<th style="width: 50px;">Art-in-Nisantasi-Url</th>
<th style="width: 50px;">Art-in-Nisantasi-Coordinate</th>
</tr>
<tr th:each="contentType:${contentTypes}">
<td th:text="${contentType.art_in_nisantasi_id}"></td>
<td th:text="${contentType.art_in_nisantasi_text}"></td>
<td th:text="${contentType.art_in_nisantasi_url}"></td>
<td th:text="${contentType.art_in_nisantasi_coordinate}"></td>
</tr>
<div>
<td
th:unless="${contentType.art_in_nisantasi_id}+'='+${selectedContent.art_in_nisantasi_id}"></td>
<td th:attr="data-id=${contentType.art_in_nisantasi_id}">
<button type="button" class="action-addButton" onclick="show">Ekle</button>
</td>
</div>
</table>
try this way :
<td th:unless="${contentType.art_in_nisantasi_id == selectedContent.art_in_nisantasi_id}"></td>
this td element will be produced or created in dom when both are not equal