How to disable the checkbox click to make atleast one check box to be selected - angularjs-directive

I am new in angular2 ,I want disable the check box unchecking if there is only one check box is checked .my html page is look like this
<div class="Columns-list-box pull-right">
<a class="Columns-list" role="button" data-toggle="collapse" href="#collapseExample-check" aria-expanded="false" aria-controls="collapseExample-check">
Columns <span class="caret"></span>
</a>
<div class="collapse Columns-list-items" id="collapseExample-check">
<ul class="sub-mnu" id="menu-check" aria-labelledby="drop5">
<li >
<label><input #idDiv type="checkbox" [(ngModel)]= "productIdValue" (change)="mapItems($event)" name="id" [checked]="defaultCheck" >Id</label>
</li>
<li>
<label><input #skuDiv type="checkbox" (change)="mapItems($event)" [(ngModel)]= "skuDivValue" checked >SKU</label>
</li>
<li>
<label><input #shortnameDiv type="checkbox" (change)="mapItems($event)" [(ngModel)]= "ShortNameValue" checked >Shortname</label>
</li>
<li>
<label><input #identifierDiv type="checkbox" (change)="mapItems($event)" [(ngModel)]="identifierDivValue" checked >Identifier</label>
</li>
<li>
<label><input #identifierTypeDiv type="checkbox" (change)="mapItems($event)" [(ngModel)]="identifierTypeValue" checked>Identifier Type</label>
</li>
</ul>
</div>
</div>
mapItems() {
if (this.productIdValue || this.skuDivValue || this.ShortNameValue || this.identifierDivValue || this.identifierTypeValue) {
}
else {
this.defaultCheck = true;
}
}

Related

Narrator announces incorrect information as "non-selected" when focus moves to the radio button

Narrator announces incorrect information as "non-selected" when focus moves to the radio button.
it should be speaking about radio button selected 1 of 2
<div>
<div tabindex="0" role="radio">
<ul>
<li class="react-custom-radio-link">
<input type="radio" name="IsPrivateProfile" id="Public" aria-checked="true">
<label for="Public">Public</label></li>
</ul>
</div>
<div tabindex="0" role="radio">
<ul class="react-custom-radio-button">
<li class="react-custom-radio-link">
<input type="radio" name="IsPrivateProfile" id="Private" aria-checked="false" checked=""><label for="Private">Private</label></li>
</ul>
</div>
</div>
It happens because it focuses first on the div which has a tabindex attribute. If you continue to the radio it will announce the correct status. My fix was to remove the focus-ability from the div
<div>
<div role="radio">
<ul>
<li class="react-custom-radio-link">
<input type="radio" name="IsPrivateProfile" id="Public" aria-checked="true">
<label for="Public">Public</label></li>
</ul>
</div>
<div role="radio">
<ul class="react-custom-radio-button">
<li class="react-custom-radio-link">
<input type="radio" name="IsPrivateProfile" id="Private" aria-checked="false" checked=""><label for="Private">Private</label></li>
</ul>
</div>
</div>

How to create html checkbox instead of asp checkbox list in asp.net

How can I create html checkbox list in asp.net instead of asp checkboxlist. I have mentioned the html code below
<ul class="check-list">
<li>
<input class="check-filter" type="checkbox">
<label class="checkbox-label">One</label>
</li>
<li>
<input class="check-filter" type="checkbox">
<label class="checkbox-label">Two</label>
</li>
</ul>
You can do something like this
<ul id="ReceiverID">
<li id="lstATo1">
<label id="ATo1">
<input type="checkbox" id="chkATo1">Admin</label></li>
<li id="lstATo7">
<label id="ATo7">
<input type="checkbox" id="chkATo7">Admin1</label></li>
<li id="lstATo3">
<label id="ATo3">
<input type="checkbox" id="chkATo3">Admin2</label></li>
<li id="lstATo9">
<label id="ATo9">
<input type="checkbox" id="chkATo9">Admin3</label></li>
<li id="lstATo6">
<label id="ATo6">
<input type="checkbox" id="chkATo6">Admin4</label></li>
<li id="lstATo8">
<label id="ATo8">
<input type="checkbox" id="chkATo8">Admin5</label></li>
</ul>

Bootstrap multi-select - Filtering issue with Group Labels

I'm using Bootstrap (2.3.2) multiselect in a Rails web application. The features I have used in multiselect are shown below:
<script type="text/javascript">
$(function() {
$('#coder_prod_select_client').multiselect({
includeSelectAllOption: true,
enableCaseInsensitiveFiltering: true,
numberDisplayed: 0,
nonSelectedText: 'Select Facility',
maxHeight: 450
});
});
</script>
Below is the HTML Code:
<div id="coder_prod_facilities_for_select">
<select name="facility[]" multiple="multiple" id="coder_prod_select_facility" style="display: none;">
<option value="multiselect-all"> Select all</option>
<optgroup label="Group 1">
<option value="114">Ancillary</option>
<option value="115">Inpatient</option>
<option value="117">Emergency</option>
</optgroup>
<optgroup label="Group 2">
<option value="80">Inpatient</option>
<option value="81">SS Surgery</option>
<option value="90">Emergency</option>
</optgroup>
<optgroup label="Group 3">
<option value="73">Inpatient</option>
<option value="75">Observation</option>
<option value="76">SS Surgery</option>
<option value="77">Ancillary</option>
</optgroup>
</select>
<div class="btn-group">
<button data-toggle="dropdown" class="multiselect dropdown-toggle btn btn-default" type="button" title="Select Facility">
Select Facility
<b class="caret"></b>
</button>
<ul class="multiselect-container dropdown-menu" style="max-height: 450px; overflow-y: auto; overflow-x: hidden;">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-search"></i>
</span>
<input type="text" class="form-control multiselect-search" placeholder="Search">
</div>
<li>
<a href="javascript:void(0);" class="multiselect-all">
<label class="checkbox"><input type="checkbox" value="multiselect-all"> Select all</label>
</a>
</li>
<li style="display: list-item;">
<label class="multiselect-group">Group 1</label>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="114"> Ancillary</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="115"> Inpatient</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="117"> Emergency</label>
</a>
</li>
<li style="display: list-item;">
<label class="multiselect-group">Group 2</label>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="80"> Inpatient</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="81"> SS Surgery</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="90"> Emergency</label>
</a>
</li>
<li style="display: list-item;">
<label class="multiselect-group">Group 3</label>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox">
<input type="checkbox" value="73"> Inpatient</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="75"> Observation</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="76"> SS Surgery</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="77"> Ancillary</label>
</a>
</li>
</ul>
</div>
</div>
Below you can see the view / HTML by default.
You could see there are similar elements under each group. For e.g, When I filter using the value 'inpatient', it is showing the result as shown in the below attachment.
But, each of the filtered 'Inpatient' values belong to separate Groups and all values should have been shown with it's group names on top!!, but it is not.
Could anyone please help me to identify and fix the issue?
You may want to check the js again, shouldn't it be $("#coder_prod_select_facility").multiselect(...)?

How to get a Bootstrap dropdown submenu to 'dropup'

I have a Bootstrap dropdown menu. The last li item is a submenu. How do I get the submenu to dropup while the full menu drops down? Here's the code:
<div class="dropdown">
<a class="inputBarA dropdown-toggle" data-toggle="dropdown" href="#">FILTER</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li role="presentation">
<a role="menuitem" href="#">Text</a>
</li>
<li role="presentation">
<label>Label name</label>
<label>Label name</label>
<label class="checkbox">
<input type="checkbox">
Text </label>
<label class="checkbox">
<input type="checkbox">
Text </label>
<label class="checkbox">
<input type="checkbox">
Text </label>
<label class="checkbox">
<input type="checkbox">
Text </label>
</li>
<li class="dropdown-submenu">
<a tabindex="-1" href="#">Centralities</a>
<ul class="dropdown-menu">
<label class="radio">
<input type="radio" name="options" id="optionsRadios1" value="A" checked>
AA </label>
<label class="radio">
<input type="radio" name="options" id="optionsRadios2" value="B">
BB </label><label class="radio">
<input type="radio" name="options" id="optionsRadios2" value="C">
CC </label><label class="radio">
<input type="radio" name="options" id="optionsRadios2" value="D">
DD </label><label class="radio">
<input type="radio" name="options" id="optionsRadios2" value="E">
EE </label>
</ul>
</li>
</ul>
</div>
The best solution:
<div class="dropup">
<ul class="dropdown-menu"></ul>
</div>
It's a native class in bootstrap. The bootstrap (using 3.1.1) css file has a .dropup .dropdown-menu selector so that's how I found out.
It sounds like the answer below would be how to do it from scratch, I was unaware there was a dropup class in Bootstrap...
So the short Bootstrap answer is to apply the class "dropup" to the <ul> in earlier versions of bootstrap:
<ul class="dropdown-menu dropup" role="menu" aria-labelledby="dLabel">
However in newer versions of bootstrap (v3) the "dropup" class needs to be applied to the <ul>'s container instead of the the <ul> itself:
<div class="dropup">
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
</div>
See http://jsfiddle.net/ZgyZP/5/
Original working answer that doesn't use bootstrap:
You could use javascript to calculate the height of the submenu and then negatively offset the submenu's position.
something like (with jQuery):
$('.dropdown-submenu').hover(
function(){
//hover in
$('.dropdown-submenu > ul').css('top', '-' + $('.dropdown-submenu > ul').css('height'));
},
//hover out
function(){
}
);
Fiddle: http://jsfiddle.net/ZgyZP/4/
Use a class, like up
<ul class="dropdown up">
Write style of up
.up { bottom:100% !important; top:auto !important; }
Note: Increase bottom as per your button size.
<div class="dropup">
<ul class="dropdown-menu"></ul>
</div>
The above code is correct, but doesn't work unless a parent element has the position property set.
Examples that works are class="col-lg-12" or just
<div style="position: relative;">
I use Bootstrap v3.0.0.
I used the dropup Class, and it worked perfectly as i expected it.
<div class="col-md-6 dropup">
<span uib-dropdown auto-close="outsideClick">
<p class="input-group">
<input type="text" class="form-control" ng-model="int.schTimeFormatted" ng-disabled="true" name="schTime" />
<span class="input-group-btn">
<button type="button" class="btn btn-default cal" uib-dropdown-toggle>
<i class="glyphicon glyphicon-time"></i>
</button>
</span>
</p>
<ul class="dropdown-menu" uib-dropdown-menu aria-labelledby="simple-dropdown">
<li class="timerDropdown">
<div class="row">
<div class="col-md-6">
<div uib-timepicker ng-model="int.schTime" ng-change="changed()" hour-step="hstep" minute-step="mstep" readonly-input="true" min="min"
max="max" show-meridian="ismeridian"></div>
</div>
<div>
Booked Timeslots
<ul id="timeListB">
<li ng-repeat="time in bookedTimeslots">{{time | date:"h:mma"}}</li>
</ul>
</div>
</div>
<hr>
<button class="pull-right">close</button>
</li>
</ul>
</span>
</div>

Radio buttons don't align properly in a menu

I have a nav-bar with a menu with radio buttons as menu elements, but they don't aligh well:
<!DOCTYPE HTML>
<div class="navbar">
<div class="navbar-inner">
<ul class="nav pull-right">
<li>
<form method="get" action="search" class="navbar-form pull-right">
<input type="text" name="q" class="input-medium search-query" placeholder="Search">
</li>
<li id="nav_search_filter" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><b class="caret"></b></a>
<ul class="dropdown-menu">
<li>Search:</li>
<li>
<input type="radio" id="search_filter_all" name ="search_filter" value="all" checked="checked"/>
<label for="search_filter_all">All</label>
</li>
<li><input type="radio" id="search_filter_inactive" name ="search_filter" value="inactive" /> <label for="search_filter_inactive">Inactive</label></li>
<li><input type="radio" id="search_filter_active" name ="search_filter" value="active" /> <label for="search_filter_active">Active</label></li>
</ul>
</li>
</form>
</ul>
</div>
</div>
http://jsfiddle.net/2SmWq/
You could try something like this:
label {margin:10px;}
input[type="radio"] {display:inline-block; vertical-align:top;}
and wrapping the labels around the input tags in the html.
here is a jsfiddle to see what I mean.
Hope this helps.
If what you want it do have the radio button and the label in the same line. Try this:
<style>
label {
display:inline-block;
}
</style>