Add and Remove Data from one table to another
Add and Remove Data from one table to another
I am looking for a way that if I click on the Add button then the data is passed to the include-table. Here is the code:
<div id="table-scroller">
<table class="table table-striped table-hover dataTable catalogueContractsTable admin-form theme-primary" cellspacing="0" width="100%" role="grid">
<thead id="tableHeader">
<tr>
<th class="bg-white">Name</th>
<th class="bg-white">Contract Type</th>
<th class="hidden-xs bg-white">Start Date</th>
<th class="hidden-xs bg-white">End Date</th>
<th class="hidden-xs bg-white">Termination Date</th>
<th class="hidden-xs bg-white text-center">Action</th>
</tr>
</thead>
<tbody id="exclude-table">
@foreach (var contract in Model.Contracts)
{
var rightNow = DateTime.UtcNow;
var classValue = "";
if (contract.Selected)
{
classValue = "selected";
if (contract.TerminationDate != default(DateTime?))
{
classValue += contract.TerminationDate < rightNow ? "bg-danger extra-light" : "bg-warning extra-light";
}
}
else
{
if (contract.TerminationDate != default(DateTime?))
{
classValue = contract.TerminationDate < rightNow ? "bg-danger extra-light" : "bg-warning extra-light";
}
}
<tr class='@classValue'>
<td>
@contract.Name
</td>
<td>
@contract.ContractTypeDescription
</td>
<td class="hidden-xs">
@contract.From.ToString("yyyy/MM/dd")
</td>
<td class="hidden-xs">
@if (contract.To != default(DateTime?))
{
@contract.To.Value.ToString("yyyy/MM/dd")
}
</td>
<td class="hidden-xs">
@if (contract.TerminationDate != default(DateTime?))
{
@contract.TerminationDate.Value.ToString("yyyy/MM/dd")
}
</td>
<td class="updateTableRow text-center">
<input type="button" class="btn btn-success btn br2 btn-xs fs12 table-btn" id="AddContractBtn" value="Add" />
</td>
</tr>
}
</tbody>
</table>
</div>
Include table:
<div id="include-table-scroller">
<table class="table table-striped table-hover dataTable catalogueContractsTable admin-form theme-primary" cellspacing="0" width="100%" role="grid">
<thead id="tableHeader">
<tr>
<th class="bg-white">Name</th>
<th class="bg-white">Contract Type</th>
<th class="hidden-xs bg-white">Start Date</th>
<th class="hidden-xs bg-white">End Date</th>
<th class="hidden-xs bg-white">Termination Date</th>
<th class="hidden-xs bg-white text-center">Action</th>
</tr>
</thead>
<tbody id="include-table">
@foreach (var contract in Model.Contracts)
{
var rightNow = DateTime.UtcNow;
var classValue = "";
if (contract.Selected)
{
classValue = "selected";
if (contract.TerminationDate != default(DateTime?))
{
classValue += contract.TerminationDate < rightNow ? "bg-danger extra-light" : "bg-warning extra-light";
}
}
else
{
if (contract.TerminationDate != default(DateTime?))
{
classValue = contract.TerminationDate < rightNow ? "bg-danger extra-light" : "bg-warning extra-light";
}
}
<tr class='@classValue'>
<td></td>
<td></td>
<td class="hidden-xs"></td>
<td class="hidden-xs"></td>
<td class="hidden-xs"></td>
<td class="updateTableRow text-center">
<input type="button" class="btn btn-danger btn br2 btn-xs fs12 table-btn" id="RemoveContractBtn" value="Remove" />
</td>
</tr>
}
</tbody>
</table>
</div>
Topic Participants
robert.broley
jakecigar