Unable to align a drop-down to the next line in angular2+ - html

I want to align my drop-down to the next line placed in a table but unable to do so.
I tried break tag -
I tried div tag -
But all to no avail.
PLease help.
Here is the screenshot -
UI Drop downs image
code -
component.html
<table>
<tr>
<td>
<div style="margin-left:50px">
<div> barchart success data -
{{barChartDataKarzaEntire[0].data[0]}} </div>
<div> barchart error data
{{barChartDataKarzaEntire[1].data[0]}}
</div>
<p> Karza Success and Error
</p>
<form (ngSubmit)="viewKarzaData(karzaValue)"
[formGroup]="karzaDataForm">
<div class="form-group">
<div>
<label> Karza Bar C Name: </label>
</div>
<br>
<br>
<div>
<select style="width:240px" class="form-control"
name="viewKarzaDataName"
[formControl]="karzaDataForm.controls['viewKarzaDataName']"
[(ngModel)]='karzaValue' placeholder="Choose an Option"
(change)="viewKarzaData(karzaValue)">
<option value="">Select</option>
<option *ngFor='let i of karzaInterfaceNames'>{{i}}</option>
</select>
</div>
<br>
<br>
<div class="card">
<div class="card-header">
Karza Bar Chart
</div>
//code
</td>
</tr>
</table>

you can use css :
<table>
<tr>
<td>
<div style="margin-left:50px">
<div> barchart success data -
{{barChartDataKarzaEntire[0].data[0]}}
</div>
<div> barchart error data
{{barChartDataKarzaEntire[1].data[0]}}
</div>
<p> Karza Success and Error
</p>
<form (ngSubmit)="viewKarzaData(karzaValue)"
[formGroup]="karzaDataForm">
<div class="form-group">
<div class="label-container">
<label> Karza Bar C Name: </label>
</div>
<br>
<br>
<div class="select-container">
<select style="width:240px" class="form-control"
name="viewKarzaDataName"
[formControl]="karzaDataForm.controls['viewKarzaDataName']"
[(ngModel)]='karzaValue' placeholder="Choose an Option"
(change)="viewKarzaData(karzaValue)">
<option value="">Select</option>
<option *ngFor='let i of karzaInterfaceNames'>{{i}}</option>
</select>
</div>
<br>
<br>
<div class="card">
<div class="card-header">
Karza Bar Chart
</div>
//code
</div>
</div>
</form>
</div>
</td>
</tr>
</table>
css:
.form-group {
margin-bottom: 1rem;
display: flex;
}
.label-container{
width:10%;
}
.select-container{
width:40%
}
.card{
width:50%;
}

Related

Drop Down contents width is wider and out of screen

HI I have the following html and this is part of the html.
<div class="pad1x flex-row leftLblMode">
<div class="pad1x flex-col-xs-12 flex-col-sm-6">
<div style="">
<label for="kaf_16" id="klb_16" class="input-control-label">
Code
<span class="mandatory">*</span>
</label>
</div>
</div>
<div class="pad1x flex-col-xs-12 flex-col-sm-6">
<select name="kaf_16" id="kaf_16" aria-label="kaf_16" aria-required="true" data-sid="ddl_code" class="input-control" data-klookup="C_1" data-kcurrentval="" style="font-weight: bold;">
<option value="+01">+01</option>
<option value="+02">+02</option>
</select>
</div>
</div>
When clicked on drop down, the contents is showing out of the screen and I am viewing the contents in mobile view in the browser.
I tried the css as below but it is not working.
.tabularView .input-control{
position: relative;
}
I am trying to find the solution and learn in the process.

How to solve the ngSwitchCase in Angular?

I've got a problem with my ngSwitchCase. Well the problem is that the case doesn't correctly fulfill its job. When I drag and drop a textbox, a textbox should appear. But When I drop the textbox, I get a textbox and textarea, which is another ngSwitchCase. Does anyoneknow what I'm doing wrong, because I can't seem to figure it out.
formadd.component.html
<fieldset class="element">
<legend class="voeg-element" placeholder="voeg element toe" cdkDropList
#doneList="cdkDropList"
[cdkDropListData]="done"
(cdkDropListDropped)="drop($event)">
<div [ngSwitch]="item" class="cdkdrag" *ngFor="let item of done" cdkDrag>
<div *ngSwitchCase="Textbox">
<input kendoTextBox>
</div>
<div *ngSwitchCase="Textarea">
<textarea kendoTextArea></textarea>
</div>
<div *ngSwitchDefault>{{item}}</div>
</div>
</legend>
</fieldset>
panelwrapper.component.html
<kendo-panelbar class="panelbar">
<kendo-panelbar-item class="panelbar-een" [title]="'Elementen'" cdkDropList cdkDropListSortingDisabled>
<kendo-panelbar-item class="panelbar-twee" [title]="'Categorie'" icon="custom-icon" cdkDrag [cdkDragData]="'Categorie'"></kendo-panelbar-item>
<kendo-panelbar-item class="panelbar-drie" [title]="'Textbox'" icon="textbox" cdkDrag>
<kendo-textbox-container floatingLabel="Text Box 1">
<input kendoTextBox placeholder="test" *cdkDragPreview/>
</kendo-textbox-container>
</kendo-panelbar-item>
<kendo-panelbar-item class="panelbar-vier" [title]="'Textarea'" icon="textarea" cdkDrag [cdkDragData]="'Textarea'"></kendo-panelbar-item>
<kendo-panelbar-item class="panelbar-vijf" [title]="'Date'" icon="calendar-date" cdkDrag [cdkDragData]="'Date'"></kendo-panelbar-item>
</kendo-panelbar>
This is what I see when I drop the textbox into the fieldset:
You will need to use single quotation marks inside of a *ngSwitchCase.
E.g:
<fieldset class="element">
<legend class="voeg-element" placeholder="voeg element toe" cdkDropList
#doneList="cdkDropList"
[cdkDropListData]="done"
(cdkDropListDropped)="drop($event)">
<div [ngSwitch]="item" class="cdkdrag" *ngFor="let item of done" cdkDrag>
<div *ngSwitchCase="'Textbox'">
<input kendoTextBox>
</div>
<div *ngSwitchCase="'Textarea'">
<textarea kendoTextArea></textarea>
</div>
<div *ngSwitchDefault>{{item}}</div>
</div>
</legend>
</fieldset>

why is conditional rendering not working for form input in vuejs

I have a form with select options :
<div>
<select>
<option v-model="department" :value="n" v-for="n in ['Please select', 'Medicine', 'Dental']">{{n}}</option>
</select>
</div>
<div class="alignBtn">
<label><span> </span><input type="submit" v-on:click.prevent="generateSlip()" value="Submit" />
</label>
</div>
and based on the selection in the above I want to display header content:
<div v-if="{department} === 'Medicine'">
<h1>Option A</h1>
</div>
<div v-else>
<h1>Option B</h1>
</div>
but every time Option B is getting outputted .
I think that the v-model directive should be in the select element. You probably meant to do this ..
<div>
<select v-model="department">
<option :value="n" v-for="n in ['Please select', 'Medicine', 'Dental']">{{n}}</option>
</select>
</div>
<div class="alignBtn">
<label><span> </span><input type="submit" v-on:click.prevent="generateSlip()" value="Submit" />
</label>
</div>
You also don't need destructuring in this case. So you can use department in your equality comparison directly ..
<div v-if="department === 'Medicine'">
<h1>Option A</h1>
</div>
<div v-else>
<h1>Option B</h1>
</div>

angular2 ngif selected show required form

I'm new to angular2
I want to create a function that when user choose an option the required form wil be show.
This is my html code
<label class="col-md-3 form-control-label" for="select">Zone</label>
<div class="col-md-9">
<select class="form-control" id="select" name="select" size="1">
<option *ngFor="let obj of zone" value={{obj.id}} ngDefaultControl>
{{obj?.name}}</option>
</select>
</div>
Let's say a user chooses Zone 1, then a form for Zone 1 appears. If a user selects Zone 2, then a form for Zone 2 appears. And so on. How can I create those functions in Angular2? I want the form to appeared in the same html page.
You can simply do this with switch cases like below.
My HTML file:
<label class="col-md-3 form-control-label" for="select">Zone</label>
<div class="col-md-9">
<select class="form-control" id="select" name="select" size="1" [(ngModel)]="selected">
<option *ngFor="let obj of zone" value={{obj.id}} ngDefaultControl>
{{obj?.name}}</option>
</select>
</div>
<div [ngSwitch]="selected">
<div *ngSwitchCase="1">
<p>1st Form</p>
</div>
<div *ngSwitchCase="2">
<p>2nd Form</p>
</div>
<div *ngSwitchCase="3">
<p>3rd form</p>
</div>
</div>
My TypeScript file
zone:Array<Object>=[
{id:1,name:"Name One"},
{id:2,name:"Name Two"},
{id:3,name:"Name Three"}
];
selected:number=0;
You can do this:
- Delare a property in component class to hold selected zone
- Then use ngIf base on above property
<label class="col-md-3 form-control-label" for="select">
<div *ngIf="selectedid==1">
Zone1
</div>
<div *ngIf="selectedid==2">
Zone2
</div>
</label>
<div class="col-md-9">
<select class="form-control" id="select" [(ngModel)]="selectedid" name="select" size="1">
<option *ngFor="let obj of zone" value={{obj.id}} ngDefaultControl>
{{obj?.name}}</option>
</select>
</div>

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
}