ngx-dropdown visibility within table using property overflow visible - css

I am trying to use the NGX dropdown menu in scrollable table however on the last row the dropdown get's cutoff by the overflow being hidden by default.
to overcome this, I set the table-responsive class to have these properties:
.table-responsive {
overflow-x: visible !important;
overflow-y: visible !important;
}
which results it having the desired look however disables my table being scrollable:
if I remove,
overflow-x: visible !important;
I get closer to my desired result however I want the dropdown to overflow out of the container, also the contents of the dropdown are initially hidden.
Is there are a way of having a scrollable table where the dropdown appears like the 2nd image.
<div class="table-responsive">
<table class="table table-bordered table-hover">
<div class="btn-group" dropdown>
<button class="btn btn-link" dropdownToggle>
<em class="fas fa-ellipsis-v fa-lg"></em>
</button>
<div *dropdownMenu class="dropdown-menu animated fadeInRight" role="menu">
<a [routerLink]="['/folder/editor', row[column.name]]" class="dropdown-item">
<em class="fas fa-fw fa-pencil-alt mr"></em>
<span>View/Edit</span>
</a>
<div class="dropdown-divider"></div>
<a [routerLink]="" (click)="openTransferLogModal(row[column.name])" class="dropdown-item">
<em class="fas fa-fw fa-list-ul mr"></em>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
</div>
</div>
<div class="table-responsive">
<table class="table table-bordered table-hover">

Is this the very last row in the table? Have you tried targeting just the ::nth-last-child selector or if its a NgFor Angular has a last-child you could utilize as well to set a class on the dropdown itself.
Either way the answer would be to adjust the absolute position of the dropdown menu on the last row. Not to mess with the table styles.
https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-last-child
http://plnkr.co/edit/evR8YKXgvpYWqHgt8zZE?p=preview
https://github.com/angular/angular/issues/10856

This is a continuation of the discussion from the solution proposed from #Jacebot
So prior to me working on the project it was revealed to me that "append to body" part of the dropdown was taken out of the code.
Putting this back, made the z-index of the dropdown go behind the body of my table.
So instead of appending to body, I appended to the table.
<div class="btn-group" dropdown container="table">
<button class="btn btn-link" dropdownToggle>
<em class="fas fa-ellipsis-v fa-lg"></em>
</button>
....

Related

How to center-align content projected into a button in PrimeNG 10?

In PrimeNG 9, I could center-align the content projected into a button. Does anybody know how this can be achieved in PrimeNG 10?
<div class="ui-g ui-fluid" >
<div class="ui-g-12">
<button pButton>
<div>Content</div>
<i class="fa fa-home"></i>
</button>
</div>
</div>
Button Rendered in PrimeNG 9:
I already submitted an issue of having the rendered when the label is missing.
https://github.com/primefaces/primeng/issues/9482
Add style="width: 100%" to your Content div.
And you can set label=" " to avoid the char while waiting fix from PrimeNG team.
See StackBlitz
PrimeNG's documentation is not up-to-date when it comes to primeflex, please check primeflex's documentation directly instead:
https://www.primefaces.org/primeflex/
Below code snippet centers a button, you can re-use that to center content within the button as well:
<div class="flex justify-content-center">
<button pButton type="button" label="Submit"></button>
</div>

Problems on alignment elements to the right without overlap

I'm having a problem with the alignment of two "buttons" (links) on the right in bootstrap.
My goals are two:
To make them as right-aligned as possible.
To always have a small margin between them.
Although at first the separation between them is more or less correct and I can get them to be aligned to the right without an excessive margin of the last element on the right side, as I reduce the size of the page, both end up overlapping.
I've managed to prevent this from happening by putting mr-x, mr-sm-x,... classes on them, but I can see that it doesn't make any sense because in order for it to work more or less well, I have to put an excessive amount of classes on them. Something like:
ml-3 ml-sm-1 ml-md-1 mr-4 mr-sm-2 mr-md-2 mr-lg-1 mr-xl-0
And the result is not optimal either.
I have tried to make it work with offset classes, with align-items-end and with justify-content-end. Also with float-right, but I always have problems with margins and overlap.
Here are some images that show the problem and the example in jsfiddle
Example on jsfiddle
Seems like you want to use Bootstrap's button groups:
<div class="container">
<nav class="navbar heading-title">
<span class="navbar-brand mb-0 h1">Título</span>
</nav>
<nav class="navbar row justify-content-end">
<div class="btn-group" role="group" aria-label="Basic example">
<a class="btn" href="#" role="button">
<i class="fa fa-user"></i>
</a> <a class="btn" href="#" role="button">
<i class="fa fa-user"></i>
</a>
</div>
</nav>
</div>
jsFiddle example

increase clickable area around tiny icon

i am using the font awesome icon ellipsis-v (which is very tiny; see here) in a clickable row, so it's frustrating to click, because most of the time you end up clicking on the row.
i tried putting the link on the td, but it's not working (because the whole row is clickable?).
are there any css tricks to increase the clickable area around the fa-icon?
(below the code i tried)
<tr class='clickable-row' data-href='details.html'>
<td></td>
<td class="client-status"><span class="label label-warning"></span></td>
<td>
<a class="doDropdown">
<div class="ibox-tools">
<a class="dropdown-toggle doDropdown" data-toggle="dropdown">
<i class="fa fa-ellipsis-v"></i>
</a>
<ul class="dropdown-menu">
<li>
View
</li>
<li>
Edit
</li>
</ul>
</div>
</a>
</td>
</tr>
Try adding the property line-height or font-size on <i> tag:
Example:
i {
line-height: 20px;
font-size: 20px;
}
You can simply add fa-nx inside the icon class, where n is the number and it simply increases the icon's size by n times its original.
Below n is 2. You can use 3, 4.. depending on your design.
<i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>

Adding font awesome icon inline yet superscript with other element

I have two scenarios with similar problems. I'm attempting to add a font awesome icon:
Inline with a text input and 'add on' button, yet superscript (JSFiddle1)
<div>
<div class="input-group">
<input class="form-control">
<span class="input-group-btn">
<button class="btn btn-default" id="copy-link" type="button">
<i class="fa fa-files-o"></i> Copy
</button>
</span>
</div>
<span>
<i class="fa fa-info-circle"></i>
</span>
</div>
Inline with text in a bootstrap panel heading text, but in the top right corner of the heading area (JSFiddle2)
<div class="panel panel-default">
<div class="panel-heading">
<b>
Text
</b>
<span>
<div class="dropdown">
<i class="fa fa-cog dropdown-toggle listing-cog" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></i>
</div>
</span>
</div>
<div class="panel-body">
</div>
</div>
Here's how I'd like each to look:
I don't know if this is important, but as a side note:
In the first scenario, the icon has a popover
In the second scenario, the icon has a dropdown
I don't think these have any effect on the layout, so I left out the related code.
For the first problem, your HTML structure is wrong. You need to add the icon inside the input-group DIV. Also to do superscript, you need a CSS class for that. Here is the update code for you:
JS Fiddle
For your second problem, your DIV must be displayed inline with a flotation. Here is the CSS for it:
.dropdown {
display:inline-block;
float:right
}
For your first issue: JS Fiddle
For your second issue as Raed N. said before just add a float:right to your dropdown:
.dropdown { float:right; }

Styling Bootstrap Dropdown Button the same as Anchor inside of a table on Firefox

I have a dropdown menu & button within a table cell. This dropdown must contain both anchors and buttons. I have no control over replacing the button elements with anchors, however, I would like the buttons to look just like standard Bootstrap menu items, so I'm styling them just like the anchors, but something strange is occurring to the width of the items. The dropdown, when located within a table, will grow to the size of a the biggest Anchor, but not the biggest button. However, when outside of the table, the dropdown menu grows to the size of the button perfectly.
I've put together a fiddle to show the problem:
http://jsfiddle.net/5p341amh/205/
<table>
<tbody>
<tr>
<td>
<div class="dropdown">
<button class="btn btn-default"
data-toggle="dropdown">
<span id="dropdown_title2">Select Something</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" >
<li><a tabindex="-1" href="#">Fooooooooooo</a></li>
<li><button tabindex="-1" href="#">Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar</button></li>
<li><button tabindex="-1" href="#">Baz</button></li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
Any insight would be great on how to fix this! Thanks!
I don't know if i understand your answer good, but you don't need to add a button element and put the anchor tag in it. You can add the anchor tag only and style it as a button.<a href="#" id="button" class="btn btn-primary " >Baaaaaaaaaaa</a>
try
display: table;
max-width: 300px /* or set your specified max-width */;

Resources