嗨,我在 MVC 3 的一个部分有两个数据表,一个显示 Table_1,一个在底部显示 Table_2。我希望有这样的功能,当我双击数据表 1(在行)时,它将弹出 Datatables 2 formAddNewRow。有没有办法做到这一点?加上 Datatables 1 ID 将被发送到弹出表单。
目前我的部分观点确实有这个:
<script type="text/javascript">
$(document).ready(function () {
$('#myItemPrice').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": '../AjaxItemPriceProvider?id=@ViewBag.ID',
"sPaginationType": "full_numbers",
"aoColumns": [
{ "sName": "ID",
"bSearchable": false,
"bSortable": false,
"bVisible": true
},
{ "sName": "PDSID",
"bSearchable": false,
"bSortable": false,
"bVisible": false
},
{ "sName": "PID" },
{ "sName": "EffDate" },
{ "sName": "ExpDate" },
{ "sName": "G140" },
{ "sName": "AccID" },
{ "sName": "CCID" }
]
});
});
$(document).ready(function () {
$('#myTierPrice').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": '../AjaxTierPriceProvider?id=@ViewBag.ID',
"sPaginationType": "full_numbers",
"aoColumns": [
{ "sName": "ID",
"bSearchable": false,
"bSortable": false,
"bVisible": false
},
{ "sName": "IPFID",
"bSearchable": false,
"bSortable": false,
"bVisible": false
},
{ "sName": "Quantity" },
{ "sName": "Amount" },
{ "sName": "Maximum Discount Percentage" },
{ "sName": "Maximum Discount Amount" },
{ "sName": "Tax 1" },
{ "sName": "Tax 2" },
{ "sName": "Commission" }
]
}).makeEditable({
sUpdateURL: "../TierPriceUpdate",
sAddURL: "../TierPriceAdd",
sDeleteURL: "../TierPriceDelete"
});
});
</script>
<div class="clear">
</div>
<div id="itemPrice">
<h2>Item Pricing List</h2>
<table id="myItemPrice" class="display">
<thead>
<th>
ID
</th>
<th>
PDSID
</th>
<th>
PID
</th>
<th>
Effective Date
</th>
<th>
Expiry Date
</th>
<th>
G140
</th>
<th>
AccID
</th>
<th>
CCID
</th>
</thead>
<tbody>
</tbody>
<tfoot>
<th>
ID
</th>
<th>
PDSID
</th>
<th>
PID
</th>
<th>
Effective Date
</th>
<th>
Expiry Date
</th>
<th>
G140
</th>
<th>
AccID
</th>
<th>
CCID
</th>
</tfoot>
</table>
</div>
<div class="clear"></div><br />
<div id="itemPrice">
<h2>Item Tier Price List</h2>
<table id="myTierPrice" class="display">
<thead>
<th>ID</th>
<th>IPFID</th>
<th>Quantity</th>
<th>Amount</th>
<th>Maximum Discount Percentage</th>
<th>Maximum Discount Amount</th>
<th>Tax 1</th>
<th>Tax 2</th>
<th>Commission</th>
</thead>
<tbody>
</tbody>
<tfoot>
<th>ID</th>
<th>IPFID</th>
<th>Quantity</th>
<th>Amount</th>
<th>Maximum Discount Percentage</th>
<th>Maximum Discount Amount</th>
<th>Tax 1</th>
<th>Tax 2</th>
<th>Commission</th>
</tfoot>
</table>
</div>
<div>
<button id="btnAddNewRow" value="Ok">
Add New Tier Price</button>
<button id="btnDeleteRow" value="cancel">
Delete Tier Price</button>
</div>
<form id="formAddNewRow" action="#" title="New Tier Price Settings">
<input type="hidden" name="ID" id="ID" value="-1" rel="0" />
<label>
Price ID</label><br />
<input type="text" name="IPFID" id="IPFID" rel="2" /><br />
<br />
<label>
Quantity</label><br />
<input type="text" name="Qty" id="Qty" rel="2" /><br />
<br />
<label>
Amount</label><br />
<input type="text" name="Amt" id="Amt" rel="3" /><br />
<font color="green">Leave empty to use default pricing</font><br />
<br />
<label>
Maximum Discount Percent</label><br />
<input type="text" name="MaxDiscPct" id="MaxDiscPct" rel="4" /><br />
<br />
<label>
Maximum Discount Amount</label><br />
<input type="text" name="MaxDiscAmt" id="MaxDiscAmt" rel="5" /><br />
<br />
<table style="border-style:none;">
<tr><td>
<label>
Tax 1</label><br />
<input type="text" name="Tax1" id="Tax1" rel="6" style="width:90px;" /><br />
<br /></td>
<td>
<label>
Tax 2</label><br />
<input type="text" name="Tax2" id="Tax2" rel="7" style="width:90px;" /><br />
<br /></td>
</tr>
</table>
<label>
Commission</label><br />
<input type="text" name="Comm" id="Comm" rel="7" /><br />
<br />
</form>
任何提示和指南将不胜感激。谢谢你。