I have a problem with my drowpdown I can't customize selected items I tried to search how can I limit dropdown choices by I didn't found a solution.
so i have 20items to show in a dropdown ,my goals is to show just 5 items and a selected item called "showMore" that after I click into it, display me a popup contains the rest of my items for example :
mylist=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t]
my_showing_list_in_dropdown=[a,b,c,d,e,showMore]
<div class="btn-group">
<button type="button" class="btn btn-light dropdown-toggle dropbtn" data-toggle="dropdown" (click)="onUpdateData()">
</button>
<div class="dropdown-menu dropdown-menu-right dropdwn" >
<a
class="dropdown-item p-1 small "
*ngFor="let x of mylist" (click)="selectedItem(x,index)"
>
<span class="mr-2"
><small style="color: gray;"
>{{x}}</small></span
>
</a>
<li class="divider"></li>
<a
class="dropdown-item p-1 small "
(click)="creation()"
>
<span class="mr-2"
><small style="color: gray;"
>SHOW More</small></span
>
</a>
</div>
</div>
How can I do it?
Related
js computes the structure below, i need a dropdown when the button is hovered whereas onclick should trigger the form submit.
nothing happens when i hover the button area. Is it because of is-active missing?
In Bulma's official docs about the dropdown menu, the example's indent can be confusing.
The "dropdown-menu" 'div' is a childnode of the main dropdown 'div'.
<div class="dropdown is-hoverable">
<div class="dropdown-trigger">
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu4">
<span>Hover me</span>
<span class="icon is-small">
<i class="fas fa-angle-down" aria-hidden="true"></i>
</span>
</button>
</div>
<div class="dropdown-menu" id="dropdown-menu4" role="menu">
<div class="dropdown-content">
<div class="dropdown-item">
<p>You can insert <strong>any type of content</strong> within the dropdown menu.</p>
</div>
</div>
</div>
</div>
I want to set sidebar menu active when clicked. Now only the first menu is selected as active. If other menus are selected, the first menu still remains as active menu. How to implement this ?
My code:
<div id="mobile_sidebar_display">
<div
class="logo_section d-flex justify-content-center align-items-center"
>
<a v-on:click="closeSideDrawer" :href="base + '/'">
<img src="../../assets/images/logo_2.svg" class="w-100" />
</a>
</div>
<div style="height: 10px"></div>
<a
v-on:click="closeSideDrawer"
class="sidebar_link active"
:href="base + '/'"
><i class="fas fa-home"></i> <span class="ml-2">Home</span></a
>
<a v-on:click="closeSideDrawer" class="sidebar_link" href="#"
><i class="far fa-user"></i> <span class="ml-2">Courses</span></a
>
<router-link class="sidebar_link" to="/QuizGrid"
><i class="fas fa-puzzle-piece"></i>
<span v-on:click="closeSideDrawer" class="ml-2"
>Puzzles</span
></router-link
>
</div>
In html A i am calling html B which contain tab as shown is the image. now the "Save " and "Save All" button is in html B i have used css to move to the top but this is not the right way to do. I need "Save" and "Save All" button in html A but for this i need to know which tab is selected.
HTML B
<div id="confi">
<div class="row">
<section widget-grid id="widget-grid">
<div class="col col-md-12">
<div ng-if="currComp" jarvis-widget id="script-widget" data-widget-color="darken" data-widget-colorbutton="false" data-widget-editbutton="false"
data-widget-deletebutton="false">
<header>
<span class="widget-icon">
<i class="fa fa-gear"></i>
</span>
<h2>Script Configuration for {{comp}}</h2>
</header>
<div class="widget-body padding-10">
<ul id="scriptTabs" class="nav nav-tabs bordered">
<li ng-repeat="s in scripts track by $index">
<a id="s{{$index}}tab" href="#s{{$index}}" data-toggle="tab">
<i class="fa fa-fw fa-lg fa-file"></i> {{s}}
<!-- <span class="badge bg-color-blue txt-color-white">6</span> -->
</a>
</li>
</ul>
<!-- style="height:400px;margin-bottom: 30px;" -->
<div id="scriptTabsContent" class="tab-content padding-10">
<div class="tab-pane active" id="s{{$index}}" ng-repeat="s in scripts track by $index">
<div style="height:753px;width: 100%;">
<div id="{{ s }}" style="height:100%;width: 100%"></div>
<div style=" position: absolute;margin-top: -910px;right: 0px;">
<button class="btn btn-sm btn-primary pull-right" style="margin-top: 20px;" ng-click="save(s)">Save</button>
<button class="btn btn-sm btn-primary pull-right" style="margin-top: 20px;margin-right: 20px;" ng-click="saveAll('all')">Save All</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
Currently i am using button in TabsContent so that i can get the value of "s" to the controller B and i cont use ng-click it is giving me error
<li ng-repeat="s in services track by $index" ng-click="functionInScope(s)">
<a id="s{{$index}}tab" href="#s{{$index}}" data-toggle="tab">
<i class="fa fa-fw fa-lg fa-file" ></i> {{s}}
</a>
</li>
please help me to get the value of "s" with out using the ng-click, so that i can send the value of "s" to the controller A for the save function.
Just a suggestion, Can't we create a variable named "selectedTab" and when you click the tab just generate a KeyUp event from that tab and in this event you can change the value this variable and while posting just get the value from that "selectedTab" variable.
For reference how to generate an click event
https://angular.io/guide/user-input
Good day
I'm trying to use Bootstrap dropdowns to display specific data stored in my API, and display said data with handlebars. I've gotten that to work however the dropdown menu only shows the list items, once you select a list item it goes back to the button's name tag ie the main dropdown button.
<div class="filterTable col-md-12">
<script class="filterDisplay" type="text/handlebars x">
<div class="dropdownMenus col-md-12">
<div class="dropdown float-left">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Brand
</button>
<ul class="dropdown-menu dropdownBrand" aria-labelledby="dropdownMenuButton">
{{#each shoes}}
<li><a class="brandDropdown dropdown-item" id="brandDropdown" value="{{this}}">{{this.brand}}</a></li>
{{/each}}
</ul>
</div>
<div class="dropdown float-left">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Size
</button>
<ul class="dropdown-menu dropdownSize" aria-labelledby="dropdownMenuButton">
{{#each shoes}}
<li><a class="sizeDropdown dropdown-item" id="sizeDropdown" value="{{this}}">{{this.size}}</a></li>
{{/each}}
</ul>
</div>
<div class="dropdown float-left">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Color
</button>
<ul class="dropdown-menu dropdownColor" aria-labelledby="dropdownMenuButton">
{{#each shoes}}
<li><a class="colorDropdown dropdown-item" id="colorDropdown" value="{{this}}">{{this.color}}</a></li>
{{/each}}
</ul>
</div>
<p data-placement="top" data-toggle="tooltip" title="Search"><button class="filterButton btn btn-success btn-xs float-left" data-title="Search">Search </button></p>
</div>
</script>
</div>
Only problem is that I can't use something like:
$('.dropdown li a').on('click', function(){
var selected = $(this).text();
$(this).parents('.dropdown').find('button').text(selected);
})
This is my first question so I hope I did everything correctly.
Thanks!
As stated in the comment, you confused dropdown component with the select element. Your HTML is not valid, as you use value attribute on the <a> tag, which is not a form element.
If you want to present a user with multiple alternatives per field, and there are many fields (your example: Brand, Size and Color), so he can follow choosing among multiple choices for each one of them and then perform another action based on his selection (Filter, for example), use html <select>, which is pre-equipped with behaviour you expect:
.form-field {
float: left;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<div class="dropdownMenus col-md-12">
<div class='form-field'>
<label for='brandFilter'>Brand</label>
<select id='brandFilter' class='form-control'>
<option>Choose brand</option>
{{#each shoes}}
<option value="{{this}}">{{this.brand}}</option>
{{/each}}
</select>
</div>
<div class='form-field'>
<label for='sizeFilter'>Size</label>
<select id='sizeFilter' class='form-control'>
<option>Choose size</option>
{{#each shoes}}
<option value="{{this}}">{{this.size}}</option>
{{/each}}
</select>
</div>
<div class='form-field'>
<label for='colorFilter'>Color</label>
<select id='colorFilter' class='form-control'>
<option>Choose color</option>
{{#each shoes}}
<option value="{{this}}">{{this.color}}</option>
{{/each}}
</select>
</div>
</div>
I added first <option>Choose {{field}}</option> just so you can see here, that option user selects replaces the selected one upon selection.
my HTML is a static variant, not a solution builded with ng-repeat or an existing JSON/Angular Controler.
I need to select a custom option and used alreay ng-select without a success.
My HTML looks like:
<div class="btn-group" dropdown>
<button type="button" class="pull-right btn btn-block btn-dropdown" dropdown-toggle>
<div class="pull-left">
<i class="flag-{{my.filter.flag}} left vcenter"></i>
<span class="vcenter">{{my.filter}}</span>
</div>
<div class="pull-right"><span class="caret"></span></div>
</button>
<ul class="dropdown-menu" dropdown-menu ng-init="options[0]">
<li ng-class="{active: my.filter == 'Germany'}">
<a ng-click="my.filter = 'Germany'; my.filter.flag='DEU'"><i class="flag-DEU"></i><span>Germany</span></a>
</li>
<li ng-class="{active: my.filter == 'England'}">
<a ng-click="my.filter = 'England'; my.filter.flag='GBP'"><i class="flag-GBP"></i><span>England</span></a>
</li>
</ul>
</div>
so how can i solve it to preselect the option "Germany" by pageloading into the div.pull-left section?
You mention ng-select in your question, but you used ng-selected. Maybe it is just a typo.