Bootstrap Datetime picker z-index - html

I am using bootstrap date time picker. Its working fine with the date and time selection. But the problem is the visibility. If I put it outside any sort of container the modal is visible. But If I try to put it as a td inside a table, then the modal is not visible. I have created a jsfiddle illustrating the same.
I have gone through the css file from the site mentioned above, and tried to set size, z-index etc. But nothing works.
Please help me set an z-index or some other solution to improve visibility.
<div class="panel panel-info" style="margin-top: 1%">
<div class="panel-heading" id="JnName">Date Picker</div>
<div class="panel-body">
<form name="form3" role="form">
<div class="table-responsive" style="size:auto; max-width: 100%;">
<table class="table table-bordered table-striped" id="System Analysis">
<tbody>
<tr>
<td width="50%">
<div class="row-fluid">
<div class="col-xs-4">
<div class="box">From Date:</div>
</div>
<div class='col-sm-8'>
<div class="form-group">
<div class='input-group date' id='rptDateFrom'>
<input type='text' name='rptDateFrom' class="form-control" id="rptDateFrom" onkeydown="return false" value='' />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#rptDateFrom').datetimepicker({
//viewMode: 'months',
format: 'DD/MM/YYYY',
widgetPositioning:
{
horizontal: 'left',
vertical: 'bottom'
}
});
});
</script>
</div>
</div>
</td>
<td width="50%">
<div class="row-fluid">
<div class="col-xs-6">
<div class="box">From Time [HH]:</div>
</div>
<div class='col-sm-6'>
<div class="form-group">
<div class='input-group date' id='cboFromTime'>
<input type='text' name='cboFromTime' class="form-control" id='cboFromTime' onkeydown="return false" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#cboFromTime').datetimepicker({
//format: 'HH:mm'
format: 'HH',
widgetPositioning:
{
horizontal: 'left',
vertical: 'bottom'
}
});
});
</script>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</form>
</div>
</div>
I have added an image to show the problem. The date picker window is hidden behind the table inside the panel and a scroll appears. Instead of that it should appear on top of all that.

Change overflow-y: hidden; to overflow-y: visible;
.table-responsive {
width: 100%;
margin-bottom: 15px;
overflow-y: visible; // Add overflow-y visible
overflow-x: scroll;
-ms-overflow-style: -ms-autohiding-scrollbar;
border: 1px solid #ddd;
-webkit-overflow-scrolling: touch;
}
Fiddle:http://jsfiddle.net/cjonkdf2/1/

The section you have added it in has overflow hidden set on it.
.table-responsive // overflow: hidden
This stops anything showing outside of itself.
Remove that and all will be good - with this at least but it might break other things
Add this css to your page/style sheet with the table in the header:
.table-responsive {
overflow: visible !important;
}

Related

Firefox Web Browser : Input Type Text Inside Click On Not Stable

i want stable input box when i click on inside input box.
this code works on google chrome but not work in firefox web browser. i want same behaviour on firefox. i have no idea where is issue. please help me thanks.
$(document).ready(function(){
var input = $(".block-search .block-content");
input.hide();
$('.block-search .block-title').click(function(){
$('.block-search .block-content').toggle();
$(".block-search .block-content .input-text").blur();
});
$(".block-search .block-content .input-text").on('click', function() {
$(".block-search .block-content .input-text").focus();
$('.block-search .block-content').show();
});
$(document).mouseup(function(e){
$('.block-search .block-content').hide();
});
});
.container {
max-width: 600px;
margin: 50px auto 0;
}
.block-title{
cursor: pointer;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<div class="container">
<div class="block block-search">
<div class="block block-title"><strong>Click Input</strong></div>
<div class="block block-content" style="display: none;">
<div class="field search">
<div class="control">
<input id="search" type="text" name="q" placeholder="Search here..." class="input-text" style="padding: 8px;">
</div>
</div>
</div>
</div>
</div>
$(document).ready(function(){
var input = $(".block-search .block-content");
input.hide();
$('.block-search .block-title').click(function(){
$('.block-search .block-content').toggle();
$(".block-search .block-content .input-text").focus();
});
$(".input-text").click(function(e) {
$('.block-search .block-content').show();
$(this).focus();
});
$(document).mouseup(function(e){
if(!$(e.target).hasClass('input-text') ) {
$('.block-search .block-content').hide();
}
});
});
.container {
max-width: 600px;
margin: 50px auto 0;
}
.block-title{
cursor: pointer;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<div class="container">
<div class="block block-search">
<div class="block block-title"><strong>Click Input</strong></div>
<div class="block block-content" style="display: none;">
<div class="field search">
<div class="control">
<input id="search" type="text" name="q" placeholder="Search here..." class="input-text" style="padding: 8px;">
</div>
</div>
</div>
</div>
</div>

Can't add found item for search bar

Actually, I have this:
I want to make a search bar like that:
Specially add all founded things below the search bar.
I'm using angular material and color theme such as explained in this question.
After compiling, then edit, this is the code of the second picture (with green div) :
<div style="display: contents;">
<div style="display: contents;">
<mat-form-field appearance="fill" class="mat-form-field ng-tns-c111-0 mat-primary mat-form-field-type-mat-input mat-form-field-appearance-fill mat-form-field-can-float ng-star-inserted" style="width: 33%; min-width: 50px; padding: 0;max-width: 500px;bottom: 0;" ng-reflect-appearance="fill">
<div class="mat-form-field-wrapper ng-tns-c111-0" style="bottom: 0;">
<div class="mat-form-field-flex ng-tns-c111-0">
<div class="mat-form-field-infix ng-tns-c111-0">
<input matinput="" type="text" class="mat-input-element mat-form-field-autofill-control ng-tns-c111-0 cdk-text-field-autofill-monitored" style="width: 33%; min-width: 50px; max-width: 500px;" ng-reflect-type="text" ng-reflect-placeholder="Search" placeholder="Search" id="mat-input-0" data-placeholder="Search" aria-invalid="false" aria-required="false">
<span class="mat-form-field-label-wrapper ng-tns-c111-0">
</span>
</div>
</div>
<div class="mat-form-field-underline ng-tns-c111-0 ng-star-inserted" style="padding: 0;margin: 0;visibility: hidden;"><span class="mat-form-field-ripple ng-tns-c111-0"></span></div>
<div class="mat-form-field-subscript-wrapper ng-tns-c111-0" ng-reflect-ng-switch="hint">
<div class="mat-form-field-hint-wrapper ng-tns-c111-0 ng-trigger ng-trigger-transitionMessages ng-star-inserted" style="opacity: 1; transform: translateY(0%);">
<div class="mat-form-field-hint-spacer ng-tns-c111-0"></div>
</div>
</div>
</div>
<div style="background-color: green;">text</div>
</mat-form-field>
</div>
</div>
The HTML part that is compiled is this:
<div style="display: contents;">
<div style="display: contents;">
<mat-form-field appearance="fill" style="width: 33%; min-width: 50px; max-width: 500px;">
<input matInput type="text" placeholder="Search" style="width: 33%; min-width: 50px; max-width: 500px;">
</mat-form-field>
</div>
</div>
I don't know how to add the "test" div with my actual HTML code. I tried to add a div below the form field, or in the form field, like that:
<div style="display: contents;">
<div style="display: contents;">
<mat-form-field appearance="fill" style="width: 33%; min-width: 50px; max-width: 500px;">
<input matInput type="text" placeholder="Search" style="width: 33%; min-width: 50px; max-width: 500px;">
</mat-form-field>
</div>
<div id="search-field"></div>
</div>
Then, in typescript use:
let div = document.getElementById("search-field");
let next = document.createElement("div");
next.innerHTML = "text";
next.classList.add("search-result");
div.appendChild(next);
But the div is added on the right of search bar (instead of below) :
Also, with different value than display: contents, I get things like that:
How can I make a good search bar?
Here is a stackblitz that is not very well ...
It could not work by adding div into the angular material components. This is how I fix it :
Create own component for the result. For this answer, it will be named <app-search-result>.
Below the head bar, add a new div:
<div style="position: fixed; z-index: 100;" id="search-result">
<app-search-result *ngFor="let searchedItem of allSearchedItem" [item]="searchedItem"> </app-search-result>
</div>
The position: fixed allow it to move everywhere without moving other div. The x-index is only to make it showed hover other divs.
Move the search result div :
#HostListener('window:resize')
onResize() {
this.moveSearchResult();
}
moveSearchResult() {
let searchResult = document.getElementById("search-result");
if(searchResult == null)
return;
let fieldBox = document.getElementById("search-field").getBoundingClientRect();
searchResult.style.marginLeft = fieldBox.x + "px";
}
The search-field is the id of the mat-form-field.
Just after adding content to the allSearchedItem array (that will contains all result), call moveSearchResult() method.
Now, this is what I have :
Bonus: I personnally add the same width/max-width as the input to make it as same size. Also, be careful with class that are declared into a specific component.

Unwanted stretched text within Span element HTML

I am trying to display a message within a span like below
<span class="glyphicon glyphicon-exclamation-sign alert alert-danger" id="ErrorMessage" style="display: none;" aria-hidden="true"></span>`
This span has no text by default but will be populated with error text depending on what error occurs.
The problem is that the text appears stretched within the element and it looks bad. I am not sure what way to approach this. Any advice would be appreciated.
EDIT: The problem only occurs when I add the "glyphicon" class.
I am populating using JS like:
var msg = document.getElementById("ErrorMessage");
msg.innerHTML = "There has been an error";`
I have no custom CSS styles involved here.
<div role="main">
<span id="maincontent"/>
<div class="container">
<div class="jumbotron">
<div style="height: 50px; float: center;">
<h3>List Herd Numbers in Commonage</h3>
</div>
<form role="form" id="HerdForm">
<div class="form-inline">
<label class="control-label" for="commonage_id">Enter Commonage ID:</label>
<input id="commonage_id" type="text" class="form-control" autofocus="autofocus"
placeholder="Enter ID here " />
<button id="submitButton" type="submit" class="btn btn-primary">View</button>
</div>
</form>
</div>
<span class="glyphicon glyphicon-exclamation-sign alert alert-danger"
id="ErrorMessage" style="display: none;" aria-hidden="true"></span>
<div id="loader" class="loader" hidden></div>
<div id="result_table" hidden>
<table class="table table-striped" id="herdTable">
<thead>
<tr>
<th class="threeTH">Herd Number</th>
<th class="threeTH">Share</th>
<th class="threeTH">Active Farmer</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
A glyphicon does not expect to have other content than the icon itself. The problem is that the glyphicon class has more styles attached to it, which are unwanted for normal text. In this case, the font family!
Solution is to put the glyphicon itself in a span of its own, inside the ErrorMessage span.
span[aria-hidden='true'] {display:none}
a:active + span[aria-hidden='true'] {display:block}
a:active + span[aria-hidden='true']::after {content:'There has been an error.';}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" type="text/css" rel="stylesheet">
<a>Press here to show text</a>
<span class="alert alert-danger" id="ErrorMessage" aria-hidden="true">
<span class="glyphicon glyphicon-exclamation-sign"></span>
</span>
You can use the glyphicon icon in separate span tag like this:
<span class="glyphicon glyphicon-exclamation-sign"></span>
<span class="alert alert-danger" id="ErrorMessage" style="display: none;" aria-hidden="true"></span>

set background image for a state/template in angularjs?

I tried putting a div tag around the whole template and styling it with css like
<div ng-style="{'background-image': 'url(/images/food.png)', 'background-repeat': 'repeat-y'}">
<img src="/images/final.png" class="brandImg center-block">
<h3 class="text-center"> Please Enter your Registered Mobile Number to Login</h3>
<form novalidate name="CSloginForm" ng-submit="loginCustomer()" role="form" class="csLoginForm col-xs-6 col-xs-offset-3">
<div class="form-group col-xs-offset-1">
<label for="phno" style="font: 22px sans-serif;">Mobile No</label>
<input type="tel" name="phno" id="phno" style="margin-left: 60px; width: 300px; margin-top: 50px; margin-bottom: 20px" class="phInput" ng-maxlength="10" ng-minlength="10" ng-model="csNumber" required />
</div>
<div class="form-actions">
<button type="submit" ng-disabled="CSloginForm.$invalid" class="btn btn-primary btn-lg col-xs-offset-9" ng-click="csLookUp()" style="margin-bottom: 10px">Start</button>
</div>
</form>
</div>
but this only puts background in a header part of the Page not the whole page?
You can use $rootScope for this. Object in the root scope are propagated to all child scopes.
angular.module('app').run(function($rootScope) {
$rootScope.app = { background-image: 'url(/images/default.png)' };
});
Now in your base HTML template you add the background to the body (not a div).
<html ng-app="app">
<head>
...
</head>
<body ng-style="{'background-image': app.background, 'background-repeat': 'repeat-y'}">
...
</body>
Given that the view has a controller
<div ng-controller="PageCtrl">
..
</div>
You can access app and set the background from the controller
angular.module('app').controller('PageCtrl', function($scope) {
$scope.app.background = 'url(/images/food.png)';
});
You can set the background in a view without a controller using ng-init, but this is discouraged.

How to put control id based on parent control reference/ID to avoid conflict

i am facing one issue due to one button control existed with same ID at two place in single page.
As i have created a custom field for jira which is appear on issue view screen and edit screen both.
"Edit" screen is just be a DIV and appear as display none till edit is clicked else issue view screen is appear (both on single page).
my created button existed on both the area.
How can we keep the condition like -
if parent is "DIV - edit" then keep different ID of button
ELSE
another ID of button. ? or any another way of jquery to resolve this conflict issue.
Below is stuff which shows same control at two place:
issue view screen stuff on a page:
.... .....
<li id="rowForcustomfield_11200" class="item">
<div class="wrap">
<strong title="final Dynamic Value" class="name">final Dynamic Value:</strong>
<div id="customfield_11200-val" class="value type-dynamicvalue editable-field active"
data-fieldtype="dynamicvalue">
<form id="customfield_11200-form" class="ajs-dirty-warning-exempt" action="#">
<div class="inline-edit-fields">
<div class="field-group">
<table id="customfield_11200:maintable">
<tbody>
<tr width="15%">
<tr width="15%">
<tr width="15%">
<tr width="15%">
<tr width="15%">
<tr width="15%">
<tr width="15%">
</tbody>
</table>
<input type="button" value="add" id="finaladd" />**PROBLEM CONTROL**
<input type="button" value="remove" id="finalremove" />**PROBLEM CONTROL**
</div>
</div>
<span class="overlay-icon throbber" />
<div class="save-options" tabindex="1">
</form>
</div>
</div>
</li>
......
....
..
note: i have highlighted above with tag comment as "PROBLEM CONTROL
Another stuff on same page for edit issue screen div:
.......
.............
<div id="edit-issue-dialog" class="aui-popup box-shadow aui-dialog-open popup-width-custom aui-dialog-content-ready"
style="width: 810px; margin-left: -405px; margin-top: -263.5px;">
<h2 class="aui-popup-heading">
<div class="aui-popup-content">
<div class="qf-container">
<div class="qf-unconfigurable-form">
<form action="#" name="jiraform" class="aui">
<div class="form-body" style="max-height: 419px;">
<input type="hidden" name="id" value="11100" />
<input type="hidden" name="atl_token" value="BP8Q-WXN6-SKX3-NB5M|6533762274aaa5d16f14dbbe010917f161596d8d|lin" />
<div class="content">
<div class="aui-tabs horizontal-tabs" id="horizontal">
<ul class="tabs-menu">
<div class="tabs-pane" id="tab-0">
<div class="tabs-pane active-pane" id="tab-1">
<div class="field-group aui-field-something">
<div class="field-group">
<div class="field-group">
<div class="field-group">
<label for="customfield_11200">
final Dynamic Value</label>
<table id="customfield_11200:maintable">
<input type="button" value="add" id="finaladd" /> **PROBLEM CONTROL**
<input type="button" value="remove" id="finalremove" /> **PROBLEM CONTROL**
</div>
</div>
</div>
<div class="field-group aui-field-wikiedit comment-input">
</div>
</div>
<div class="buttons-container form-footer">
</form>
</div>
</div>
</div>
</div>
.....
...
..
NOTE: above highlighted issue at PROBLEM CONTROL tag comment.
I think you can differentiate by using the id edit-issue-dialog
if($("#edit-issue-dialog").length){
//u r in edit form, and do your stuff
}else{
//in create form do your stuff
}