I'm experimenting with Autoforms and an array field in a html table. So far I can modify rows and delete them, but am having trouble working out how to add a new row. The add button doesn't seem to do anything.
My code so far:
{{#autoForm id="eventDatesForm" type="update" collection="Events" doc=this buttonContent="Save"}}
<h2>Event Dates</h2>
{{> afQuickField name="timezone"}}
<table class="table table-bordered table-hover table-condensed">
<thead>
<tr>
<th>Slice Start</th>
<th>Slice End</th>
<th><button type="button" class="btn btn-primary autoform-add-item" data-autoform-field="{{this.atts.name}}" data-autoform-minCount="{{this.atts.minCount}}" data-autoform-maxCount="{{this.atts.maxCount}}"><span class="glyphicon glyphicon-plus"></span></button></th>
</tr>
</thead>
{{#afEachArrayItem name="WiFiOffloadSettings"}}
<tbody>
<tr>
<td>{{> afFieldInput name=this.current.offloadSliceStart type=datetime}}</td>
<td>{{> afFieldInput name=this.current.offloadSliceEnd type=datetime}}</td>
<td><button type="button" class="btn btn-danger btn-sm autoform-remove-item"><span class="glyphicon glyphicon-minus"></span></button></td>
</tr>
</tbody>
{{/afEachArrayItem}}
</table>
<button type="submit" class="btn btn-primary">Save</button>
{{/autoForm}}
In the Add button, try using the name "WiFiOffloadSettings".
That is,
<button type="button" class="btn btn-primary autoform-add-item"
data-autoform-field="WiFiOffloadSettings" data-autoform-minCount="
{{this.atts.minCount}}" data-autoform-maxCount= {this.atts.maxCount}}">
<span class="glyphicon glyphicon-plus"></span> </button>
Related
I have 10 buttons and I would like to place the buttons on the top right, but I don't know how to do it? Currently my buttons are at the bottom, I don't know how to move my buttons?
I would like to get this result, (see below)
example
I think I need to use a display:flex ?
Do you have any idea, please?
Here is my code below
Thank you in advance for your help et your time.
<!DOCTYPE html>
<html>
<head>
<title>HTML CSS JS</title>
</head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<body>
<div class="home-content container">
<h1 class="text-center pt-5 pb-3">Signalétique</h1>
<div class="row pt-3 container">
<div class="card" style="width: 100%;">
<div class="card-body">
<table class="table table-hover table-striped" style="width: 60%">
<tbody>
<tr>
<th>Ticker</th>
<td>SOLB</td>
</tr>
<tr>
<th>Code SVM</th>
<td>347075</td>
</tr>
<tr>
<th>Code ISIN</th>
<td>BE00003470755</td>
</tr>
<tr>
<th>Genre</th>
<td>Actions</td>
</tr>
<tr>
<th>Pays d'origine</th>
<td>Belgique</td>
</tr>
<tr>
<th>Secteur économique</th>
<td>Matériaux</td>
</tr>
<tr>
<th>Devise de cotation</th>
<td>EUR</td>
</tr>
<tr>
<th>Groupe de cotation</th>
<td>(AO)</td>
</tr>
<tr>
<th>Unité de cotation</th>
<td>1,0000000</td>
</tr>
<tr>
<th>Site Internet</th>
<td>www.solvay.com</td>
</tr>
</tbody>
</table>
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary mb-2 ">Best Execution</button>
<button type="button" class="btn btn-primary mb-2">Etat du marché</button>
<button type="button" class="btn btn-primary mb-2">Graphiques Historiques</button>
<button type="button" class="btn btn-primary mb-2">Historique des cours</button>
<button type="button" class="btn btn-primary mb-2">Ordre</button>
</div>
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary mb-2 ms-2">Best Execution</button>
<button type="button" class="btn btn-primary mb-2 ms-2">Etat du marché</button>
<button type="button" class="btn btn-primary mb-2 ms-2">Graphiques Historiques</button>
<button type="button" class="btn btn-primary mb-2 ms-2">Historique des cours</button>
<button type="button" class="btn btn-primary mb-2 ms-2">Ordre</button>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Minor adjustments will need to be made to the columns, but here's a solution:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous" />
<body>
<div class="home-content container">
<h1 class="text-center pt-5 pb-3">Signalétique</h1>
<div class="row pt-3 container">
<div class="card" style="width: 100%;">
<div class="card-body">
<div class="row">
<div class="col">
<table class="table table-hover table-striped" style="width: 60%;">
<tbody>
<tr>
<th>Ticker</th>
<td>SOLB</td>
</tr>
<tr>
<th>Code SVM</th>
<td>347075</td>
</tr>
<tr>
<th>Code ISIN</th>
<td>BE00003470755</td>
</tr>
<tr>
<th>Genre</th>
<td>Actions</td>
</tr>
<tr>
<th>Pays d'origine</th>
<td>Belgique</td>
</tr>
<tr>
<th>Secteur économique</th>
<td>Matériaux</td>
</tr>
<tr>
<th>Devise de cotation</th>
<td>EUR</td>
</tr>
<tr>
<th>Groupe de cotation</th>
<td>(AO)</td>
</tr>
<tr>
<th>Unité de cotation</th>
<td>1,0000000</td>
</tr>
<tr>
<th>Site Internet</th>
<td>www.solvay.com</td>
</tr>
</tbody>
</table>
</div>
<div class="col">
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary mb-2">
Best Execution
</button>
<button type="button" class="btn btn-primary mb-2">
Etat du marché
</button>
<button type="button" class="btn btn-primary mb-2">
Graphiques Historiques
</button>
<button type="button" class="btn btn-primary mb-2">
Historique des cours
</button>
<button type="button" class="btn btn-primary mb-2">
Ordre
</button>
</div>
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary mb-2 ms-2">
Best Execution
</button>
<button type="button" class="btn btn-primary mb-2 ms-2">
Etat du marché
</button>
<button type="button" class="btn btn-primary mb-2 ms-2">
Graphiques Historiques
</button>
<button type="button" class="btn btn-primary mb-2 ms-2">
Historique des cours
</button>
<button type="button" class="btn btn-primary mb-2 ms-2">
Ordre
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
Try using a flexbox 👍🏼
First use main container then display it as flex and with some container and items properties you will get what you want
Display : flex
And proceed ....
Good Afternoon,
I'm having a problem trying to get my font awesome icons to work as expected, I have a shopping cart where hardware can be ordered, an address field is provided for each item so the user can send hardware to different locations, as each location is provided I want the icon to change from a cross to a tick, I'm using AngluarJS form validation:
Problem I have is the icon only changes when the last address is entered, I'm sure I need to use an $index or something like it but can't figure it out:
Here is my code...
<table id="cart" class="table table-hover table-condensed">
<thead>
<tr>
<th style="width:55%;">${Product} </th>
<th style="width: 1%;">${Quantity}</th>
<th style="width: 24%;">${Delivery Address:}</th>
<th style="width: 1%;"></th>
<th style="width: 19%;"><span style="visibility: hidden;">${Item Controls}</span></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in c.data.cartItems track by item.sys_id | orderBy: 'order'">
<td data-th="Product">
<div class="row">
<div class="col-sm-2 visible-lg"><img ng-show="item.picture" ng-src="{{item.picture}}" alt="{{item.name}}" class="img-responsive item-image"/></div>
<div class="col-sm-10">
<h2 class="nomargin h4">{{item.name}}</h2>
<p class="hidden-xs">{{item.short_description}}</p>
{{item.sys_id}}
</div>
</div>
</td>
<td data-th="Quantity">
<input type="number"
title="${Quantity}"
ng-if="item.show_quantity"
class="form-control text-center"
ng-model="item.quantity"
min="1"
max="20"
ng-model-options="{ updateOn: 'blur' }"
ng-change="c.updateQuantity(item)">
<span ng-if="!item.show_quantity">-</span>
</td>
<td>
<select ng-model="address" name="address" ng-options="address.value for address in data.userAddress | filter:{u_active_address:'true'} track by address.value"
ng-change="c.updateAddress(item.quantity, item.sys_id, address.value, $index, item)"
id="address" class="dropdown pull-right" style="height: 30px;">
</select>
</td>
<td>
<i ng-show="myForm.address.$dirty" class="fa fa-check-circle" style="color:#008000;">{{myForm.address.$dirty}}</i>
<i ng-show="myForm.address.$pristine" class="fa fa-exclamation-circle" style="color:#FF6347;">{{myForm.address.$pristine}}</i>
</td>
<td class="col-md-12 text-right">
<button title="Edit" class="btn btn-info btn-sm" data-toggle="modal" data-target="#myModal" aria-label="${Edit Item} {{item.name}}" ng-show="item.has_options" ng-click="c.editItem(item.sys_id)"><i class="fa fa-edit"></i></button>
<button title="Remove" class="btn btn-danger btn-sm" aria-label="${Remove Item From Cart} {{item.name}}" ng-click="c.removeItem($event, item)"><i class="fa fa-trash"></i></button>
</td>
</tr>
</tbody>
</table>
Lines of interest:
<select ng-model="address" name="address" ng-options="address.value for address in data.userAddress | filter:{u_active_address:'true'} track by address.value"
ng-change="c.updateAddress(item.quantity, item.sys_id, address.value, $index, item)"
id="address" class="dropdown pull-right" style="height: 30px;">
</select>
<td>
<i ng-show="myForm.address.$dirty" class="fa fa-check-circle" style="color:#008000;">{{myForm.address.$dirty}}</i>
<i ng-show="myForm.address.$pristine" class="fa fa-exclamation-circle" style="color:#FF6347;">{{myForm.address.$pristine}}</i>
</td>
Images Attached:
Cart OnLoad
Last Address Changed
Any help and I would be grateful
Found the solution here:
How to validate inputs dynamically created using ng-repeat, ng-show (angular)
Updated Code:
<td>
<select ng-model="address" name="address{{$index}}" ng-options="address.value for address in data.userAddress | filter:{u_active_address:'true'} track by address.value"
ng-change="c.updateAddress(item.quantity, item.sys_id, address.value, $index)"
id="address" class="dropdown pull-right" style="height: 30px;">
</select>
</td>
<td>
<i ng-show="myForm['address' + $index].$dirty" class="fa fa-check-circle" style="color:#008000;"> {{myForm.address.$dirty}}{{fieldUpdated}}</i>
<i ng-show="myForm['address' + $index].$pristine" class="fa fa-exclamation-circle" style="color:#FF6347;"> {{myForm.address.$pristine}}</i>
</td>
Why can't Handlebars check if the Custom Claims Admin is true it automatically goes to the else statement even though the statement for the custom claims is true. Photo of the CustomClaims attached.
{{#each listusersarray}}
<tr>
<td>{{email}}</td>
<td>{{metadata.lastSignInTime}}</td>
<td>{{#if metadata.customClaims.admin}}Admin{{else}}User{{/if}}</td>
<td>
{{!-- <input type="hidden" value="{{uid}}" id="user-uid"> --}}
{{#if disabled}}
<button class="btn btn-success " type="button" onclick="enableaccountFunction('{{uid}}')">Enable Account</button>
{{else}}
<button class="btn btn-danger " type="button" onclick="disableaccountFunction('{{uid}}')">Disable Account</button>
{{/if }}
<input type="hidden" value="{{email}}" id="admin-email">
<button class="btn btn-primary " onclick="makeadminFunction('{{uid}}')">Make Admin</button>
</td>
</tr>
{{/each}}
my bad customClaims is not under metadata thats why it is undefined its only customClaims.admin
I am a beginner in this language I've used php before.
So the table has a button and when I clicked the button it only read the first row it won't read the other rows, In php ive used the function attr so it will read the other clicked row and here at reactjs i don't know how please help
return <tr key={i} >
<td>{d.Employee_Name}</td>
<td>{d.Address}</td>
<td><center><button className ="btn btn-info" onClick={ this.props.onClick } data-toggle="modal" data-target="#UpdateEmployee">Update</button></center></td>
<td><center><button className ="btn btn-danger">Delete</button></center></td>
<div className="modal fade" id="UpdateEmployee" role="dialog">
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-header">
<button type="button" className="close" data-dismiss="modal">×</button>
<h4 className="modal-title">Update Employee</h4>
</div>
<div className="container">
<div className="modal-body">
<table>
<tbody>
<tr>
<td>Name</td>
<td> <input type="text"value={ d.Employee_Name} /> </td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" value={ d.Address} /> </td>
</tr>
</tbody>
</table>
</div>
</div>
<div className="modal-footer">
<botton className="btn btn-info"> Update Employee</botton>
<button type="button" className="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</tr>
}
To get the index of item clicked, you need to bind the index to onClick function for each element, like this:
<td>
<center>
<button ... onClick={() => this.props.onClick(i) }></button>
</center>
</td>
Note: replace ... by other properties you are using.
Whenever you click on any item, index i will get passed to this.props.onClick method, you can check that by using console.log in parent onClick function, like this:
onClick(index){
console.log(index); // it will print the index of item clicked
}
I am trying to insert an input in the header of Angular-UI's accordion, but the accordion messes up when the input is shown. I think it might be because I hide the actual heading text so the height of the header changes and the accordion messes up. Ideally, I would like to keep the height dynamic (responsive point-of-view), but a fixed height will do as well.
When the edit button is clicked, I want to show an input field in the header so the user can update the text (saving, or binding the value is not a concern.. just want to show the input field correctly).
I have a demo of what I am wanting using a table, and I would like to replicate that functionality into the accordion header.
<table class="table table-bordered table-striped table-hover">
<thead>
<tr id="th-row">
<th>Name</th>
<th class="col-xs-1">Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span ng-show="!edit" ng-model="personName">John Smith</span>
<div ng-show="edit" class="col-xs-12">
<input type="text" ng-model="personName" ng-required="true" value="" class="form-control" placeholder="Person Name">
</div>
</td>
<td>
<button ng-show="!edit" class="btn btn-xs btn-primary" ng-click="edit = true">
<i class="glyphicon glyphicon-edit"></i>
</button>
<button ng-show="edit" class="btn btn-xs btn-danger" ng-click="edit = false">
<i class="glyphicon glyphicon-remove"></i>
</button>
</td>
</tr>
</tbody>
</table>
Now my accordion code:
<accordion-group>
<accordion-heading>
<span ng-show="!edit1" ng-model="headingName">Header with Button group</span>
<div ng-show="edit1" class="col-xs-12">
<input type="text" ng-model="headingName" ng-required="true" value="" class="form-control" placeholder="Heading Name">
</div>
<div class="pull-right">
<button ng-show="!edit1" class="btn btn-info btn-xs" ng-click="edit1 = true; $event.stopPropagation();"><i class="glyphicon glyphicon-edit"></i></button>
<button ng-show="edit1" class="btn btn-danger btn-xs" ng-click="edit1 = false; $event.stopPropagation();"><i class="glyphicon glyphicon-remove"></i></button>
</div>
</accordion-heading>
This is just some content to illustrate fancy headings.
</accordion-group>
Here is a Plunker Demo