npm install --save datatables.net-vue3 - to install datatable package
import DataTable from "datatables.net-vue3";
<!-- checkboxes where we can select columns to be displayed -->
<div>
<input type="checkbox" name="column" id="fieldId1" value="id" v-model="column"/>
<label for="fieldId1">Id</label>
</div>
<div>
<input type="checkbox" name="column" id="fieldId2" value="title" v-model="column"/>
<label for="fieldId2">Title</label>
</div>
<div>
<input type="checkbox" name="column" id="fieldId3" value="start" v-model="column"/>
<label for="fieldId3">Start</label>
</div>
<div>
<input type="checkbox" name="column" id="fieldId4" value="date of arrival" v-model="column"/>
<label for="fieldId4">Date of arrival</label>
</div>
<div>
<input type="checkbox" name="column" id="fieldId5" value="status" v-model="column"/>
<label for="fieldId5">Status</label>
</div>
<DataTable :data="data" class="display table-responsive">
<thead>
<tr>
<th>Id</th>
<th>Title</th>
<th>Start</th>
<th>Date of arrival</th>
<th>Status</th>
</tr>
</thead>
</DataTable>
only columns selected from checkboxes should be displayed in table.
Related
I want to send data to database table. but there are two submit buttons. 1.Accept 2.Reject. When you click the Accept button, the database will receive the input "value = accepted," and when you click the Reject button, the database will receive the input "value = rejected." The problem is that if you click on any button, "input value = accepted" is sent to the table.
This is my form.
#foreach($attendance as $request)
<form class="d-sm-inline-block" method="POST" action="/update" enctype="multipart/form-data">
#csrf
<tr>
<th scope="row">
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['id']}}</label>
<input type="hidden" value="{{$request['id']}}" name="id" class="form-control">
</div>
</th>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['name']}}</label>
<input type="hidden" value="{{$request['name']}}" name="name" class="form-control">
</div>
</td>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['class']}}</label>
<input type="hidden" value="{{$request['class']}}" name="class" class="form-control">
</div>
</td>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['roll_number']}}</label>
<input type="hidden" value="{{$request['roll_number']}}" name="rollnumber" class="form-control">
</div>
</td>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['subject_name']}}</label>
<input type="hidden" value="{{$request['subject_name']}}" name="subject" class="form-control" >
</div>
</td>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['attendance']}}</label>
<input type="hidden" value="{{$request['attendance']}}" name="attendance" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
</td>
<td>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">{{$request['status']}}</label>
<input type="hidden" value="{{$request['status']}}" name="status" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
</td>
<td>
<div class="mb-3">
<input type="hidden" value="Accepted" name="status" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
<input type="hidden" value="Rejected" name="status" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
<button type="submit" class="btn btn-success" action="action" value="accept">accept</button>
<button type="submit" class="btn btn-warning" action="action" value="reject">Reject</button>
</tr>
</form>
#endforeach
remove:
<div class="mb-3">
<input type="hidden" value="Accepted" name="status" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
<input type="hidden" value="Rejected" name="status" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
and change this:
<button type="submit" class="btn btn-success" action="action" value="accept">accept</button>
<button type="submit" class="btn btn-warning" action="action" value="reject">Reject</button>
to:
<button type="submit" name="status" class="btn btn-success" action="action" value="accept">accept</button>
<button type="submit" name="status" class="btn btn-warning" action="action" value="reject">Reject</button>
Your submit buttons have no name attribute so their values won't be there in the request.
I working on form which has nested form groups & form arrays but I am not able to bind values in ts.
I am new to angular so dont have much clarity on formgroup and form arrays.
below json can have multiple arrays within formgroups and nested form arrays within form group.
Here is the sample example which i want to execute and make below json structure from this form
Json using this form :
{
ip:'1.2.3.4',
create_adjacency:{
customerName:'ABC',
traffic_group:[{
_display_name:'DEF',
traffic_group_limits:{
calls:'23' }
}]
}
}
HTML -
<div class="page-container pb-25 ">
<form [formGroup]="firstFormGroup">
<div class="form-group custom-input select-custom-prime">
<label>IP</label>
<input
placeholder="Select"
formControlName="ip"
/>
</div>
<div class="row mb-20" formGroupName="create_adjacency">
<div class="col-xl-4 col-lg-6 col-md-6">
<div
class="form-group custom-input select-custom-prime"
>
<label>Customer Name</label>
<input
placeholder="Select"
formControlName="customerName"
/>
</div>
</div>
<div formArrayName="traffic_group">
<div class="col-xl-3 col-lg-6 col-md-6">
<div
class="form-group custom-input mr-10 select-custom-prime" >
<label>Traffic group Name</label>
<input
formControlName="_display_name"
/>
</div>
</div>
<table
class="mt-30 table table-striped table-bordered wd-98"
>
<thead>
<tr>
<th>Traffic Group Name</th>
<th>Concurrent Calls</th>
</tr>
</thead>
<tbody formGroupName="traffic_group_limits">
<tr>
<td>
<div class="">
<div
class="form-group custom-input select-custom-prime"
>
<input
pInputText
autofocus
disabled
type="text"
class="form-control"
/>
</div>
</div>
</td>
<td>
<div class="">
<div
class="form-group custom-input select-custom-prime"
>
<input
formControlName="calls"
pInputText
autofocus
class="form-control"
/>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</form>
</div>
Ts code -
this.firstFormGroup = this.formBuilder.group({
ip: [''],
create_adjacency: this.formBuilder.group({
customerName: ["", Validators.required],
traffic_groups: this.formBuilder.array([this.traffic_groups])
})
});
get traffic_groups(): FormGroup {
return this.formBuilder.group({
_display_name: ["", Validators.required],
traffic_group_limits: this.formBuilder.group({
"call-appearances": ["", Validators.required]
})
});
}
In my opinion, as much angular has their own way of doing this, it might be a little intimidating to a beginner. So I prefer breaking down the formgroups and then constructing the final json from all the forms all together.
.html
<div class="page-container pb-25 ">
<form [formGroup]="firstFormGroup">
<div class="form-group custom-input select-custom-prime">
<label>IP</label>
<input
placeholder="Select"
formControlName="ip"
/>
</div>
<div class="row mb-20" [formGroup]="adjacencyFormGroup">
<div class="col-xl-4 col-lg-6 col-md-6">
<div
class="form-group custom-input select-custom-prime"
>
<label>Customer Name</label>
<input
placeholder="Select"
formControlName="customerName"
/>
</div>
</div>
<div [formGroup]="trafficFormGroup">
<div class="col-xl-3 col-lg-6 col-md-6">
<div
class="form-group custom-input mr-10 select-custom-prime" >
<label>Traffic group Name</label>
<input
formControlName="_display_name"
/>
</div>
</div>
<table
class="mt-30 table table-striped table-bordered wd-98"
>
<thead>
<tr>
<th>Traffic Group Name</th>
<th>Concurrent Calls</th>
</tr>
</thead>
<tbody [formGroup]="trafficGroupLimit">
<tr>
<td>
<div class="">
<div
class="form-group custom-input select-custom-prime"
>
<input
pInputText
autofocus
disabled
type="text"
class="form-control"
/>
</div>
</div>
</td>
<td>
<div class="">
<div
class="form-group custom-input select-custom-prime"
>
<input
formControlName="calls"
pInputText
autofocus
class="form-control"
/>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</form>
</div>
.ts
this.firstFormGroup = this.formBuilder.group({
ip: [''],
create_adjacency: [{}]
});
this.adjacencyFormGroup = this.formBuilder.group({
customerName: ["", Validators.required],
traffic_groups: [[]])
});
this.trafficFormGroup = this.formBuilder.group({
_display_name: ["", Validators.required],
traffic_group_limits: [{}]
});
this.trafficGroupLimit = this.formBuilder.group({
calls: [''],
});
function to create json
createFormJSON() {
this.trafficFormGroup.patchValue({
traffic_group_limits: this.trafficGroupLimit.value
});
this.adjacencyFormGroup.patchValue({
traffic_groups: this.allTrafficGroups // store all traffic groups in this array before patching
});
this.firstFormGroup.patchValue({
create_adjacency: this.adjacencyFormGroup.value,
});
}
AM using bootstrap 3 for my python web application. I want to use the application in mobile devices also. but the input form fields are become responsive to the width of the device. I want in input field width to be static as in browser . please advice how to achieve this?
below is the html which am using
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
<div class="col-md-2 pull-left">
Add Timesheet Details
</div>
<div class="col-md-8 text-center">
<label class="control-label" for="timesheet_no">Time Sheet Number:01</label>
</div>
</div>
</div>
<div class="panel-body">
<form id="add_detail" class="form-horizontal" action="" method="post" name="page">
<div style="display:none;"><input id="csrf_token" name="csrf_token" type="hidden" value="1434973923##5ac019cd8821a1dfda978dde3710893c8b0ced33"></div>
<div class="form-group">
<div class="repeat" id="dimdetail-fieldset">
<div class="col-md-12">
<div class ="table-responsive">
<table id="table_id" class="wrapper table table-bordered">
<thead>
<tr>
<th class="col-md-2"><button type="button" class="add btn btn-primary pull-left" id="add_time"><i class="glyphicon glyphicon-plus"></i>  Time</button></th>
</tr>
</thead>
<tbody class="container">
<tr class="success">
<th class="col-md-2">Project</th>
<th class="col-md-2">Total Hours</th>
<th class="col-md-2">TPI Inspector Name</th>
<th class="col-md-2">Inspection Type</th>
<th class="col-md-2">Remarks</th>
<th></th>
</tr>
<tr >
<td class="form-group col-md-2">
<select class="form-control" id="timesheet_time_details-0-project_id" name="timesheet_time_details-0-project_id" style="width:100%"><option value="">-- please choose --</option>
<option value="12997">12997</option></select>
</td>
<td class="form-group col-md-2">
<input class="form-control" id="timesheet_time_details-0-total_hours" name="timesheet_time_details-0-total_hours" type="text" value="10.0">
</td>
<td class="form-group col-md-2">
<input class="form-control" id="timesheet_time_details-0-tpi_inspector_name" name="timesheet_time_details-0-tpi_inspector_name" type="text" value="Ram">
</td>
<td class="form-group col-md-2">
<select class="form-control" id="timesheet_time_details-0-testmethod" name="timesheet_time_details-0-testmethod" style="width:100%"><option value="__None">-- please choose --</option><option selected value="1">UltraSonic Inspection</option></select>
</td>
<td class="form-group col-md-2">
<textarea class="form-control" id="timesheet_time_details-0-remarks" name="timesheet_time_details-0-remarks" rows="3">ok</textarea>
</td>
<td class="col-md-1">
<button class="remove btn btn-danger" type="button" id=""><i class='glyphicon glyphicon-trash'></i> Delete</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<div class="row">
<div class="col-md-10 pull-left">
<button class="btn btn-primary" type="submit" value="Save" name="Save"><i class="glyphicon glyphicon-save"></i>  Save</button>
<button class="btn btn-success" type="submit" value="Submit for Approval" name="Save"><i class="glyphicon glyphicon-ok-circle"></i>  Submit for Approval</button>
<button id="delete" class="btn btn-danger" type="submit" value="Delete" name="Save"><i class="glyphicon glyphicon-trash"></i>  Delete</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
Add the below css
.form-control {width:150px} /*the width you want*/
make sure it renders after your bootstrap css. You are however getting rid of the responsiveness of the row that contains the inputs.
here is a bootply example
I am trying to upload a file using the following script. The script uploads the file via browse button, but when I click on the upload button, it gives an error //Error on file size.
FYI - manually upload for the same file is successful
My script:
driver.findElement(By.xpath(".//*[#id='fileUploadInput']/div/div[2]/input[2]")).sendKeys(file_upload);
driver.findElement(By.id("btnCreativeHostingFileUpload")).click();
HTML:
<tr id="fileOas" style="display: table-row;">
<td align="left" style="height:25px;">File Name</td>
<td nowrap="" align="left" style="height:40px;">
<input type="hidden" style="width:250px" name="uploadFileName" id="videoUploadFileName" value="tag.png">
<div onclick="setActiveUploadForUploadAll();" style="height:40px;">
<!-- <iframe id="sUploadAll" name="sUploadAll" onmouseover="setActiveUpload('sUploadAll');" -->
<iframe width="470" height="40" frameborder="no" allowtransparency="true" scrolling="no" src="/richmedia/oas/FileUpload.do?nextAction=/oas/adwizard.banner.update.do¤tPage=/oas/adwizard.creative.index.do&fileCategory=image&fieldName=videoUploadFileName&previousFile=" onmouseover="prepareActiveUpload('sUploadAll');" name="sUploadAll" id="sUploadAll">
</iframe>
<input type="hidden" name="videoUploadFileNameFullUrl" id="videoUploadFileNameFullUrl" value="tag.png">
<input type="hidden" name="videoUploadFileDownloadUrl" id="videoUploadFileDownloadUrl">
<input type="hidden" value="" id="currentSelectFileId">
<input type="hidden" value="" id="currentSelectFileType">
<input type="hidden" name="uploadFileNameFullUrl" id="uploadFileNameFullUrl" value="tag.png">
<input type="hidden" name="dimensionWidth" id="dimensionWidth">
<input type="hidden" name="dimensionHeight" id="dimensionHeight">
</div>
</td>
</tr>
<div>
<div class="input_div">
<input type="text" readonly="readonly" class="file_input_textbox" id="fileName">
</div>
<div class="file_input_div">
<input type="button" value="Browse" class="file_input_button">
<input type="file" style="width:100px;" onchange="javascript: document.getElementById('fileName').value = this.value" value="" size="25" name="theFile">
</div>
<div class="upload_btn_div">
<button onclick="showProgressAndUpload(this.form);" name="btnCreativeHostingFileUpload" id="btnCreativeHostingFileUpload" type="button" style="margin-left: 10px" class="btn btn_gray"><div><p>Upload</p></div></button>
</div>
</div>
Looks like you are using wrong selector
Try this cssSelector
[type='file']
Or, that input tag has the name as well. So you can use theFile as By.name
So, far in that's the only file input tag I am seeing in the html you have provided
You can also do this with JavaScript executor in case the above does not work
String filePath = "the filepath with extension";
((JavascriptExecutor)driver).executeScript("document.getElementById('fileName').setAttribute('value', '"+filePath+"');");
driver.findElement(By.id("btnCreativeHostingFileUpload")).click();
in bootstrap 3 i want an input in one row by grouping the input i done it but the space is not occurring can any one help http://jsfiddle.net/qkPEm/1/
<div class="row">
<div class="col-lg-3">
<div class="input-group">
<input id="dd" class="location" name="city" type="text" placeholder="Source" size="90" />
</div>
</div>
<div class="col-lg-3">
<div class="input-group">
<input id="geocomplete" class="location" name="city" type="text" placeholder="Destination" size="90" />
</div>
</div>
<div class="col-lg-2">
<div class="input-group">
<input class="input-append form-date" readonly="true" type="text" id="dpd1" placeholder="From" value="" name="arrival" data-date-format="dd/mm/yyyy">
</div>
</div>
<div class="col-lg-2">
<div class="input-group">
<input class="input-append form-date" readonly="true" type="text" id="dpd2" placeholder="To" value="" name="departure" data-date-format="dd/mm/yyyy">
</div>
</div>
<div class="col-lg-2">
<div class="input-group">
<input class="guests" class="date" readonly="true" type="text" id="tags2" placeholder="Ttl.Expenses" value="" name="guests" />
</div>
</div>
</div>
Input size causing the issues.
Here's my method on solving the white space.
http://www.bootply.com/PRnJqqD8S3
Your input size is way over the col-lg-2's width, that's why you got the extra spacing.