我有一個日期選擇範圍,以及兩個單選按鈕,我需要過濾數據表我。基本上,我後如下:
用戶從拾取範圍 用戶選擇日期然後選擇值日期或日期信息單選按鈕 用戶點擊過濾器按鈕,並且基於他們的選擇的確定時代fileters。
我的數據表由兩個日期列組成,它們由單選按鈕表示。以用戶輸入爲例。
從2012年4月3日至2011年3月3日的價值日期列。
任何指針?因爲它代表
代碼:
<article class="module width_full">
<header><h3>Message Detail</h3></header>
<div id="radio">
<label for="from">From</label>
<input type="text" id="from" name="from" />
<label for="to">to</label>
<input type="text" id="to" name="to" />
<label for="mdValueDate">Value Date</label>
<input type="radio" id="mdValueDate" name="radio" />
<label for="mdMessageDate">Message Date</label>
<input type="radio" id="mdMessageDate" name="radio" />
<button id="btnFilterMd">Filter</button>
<button id="btnClearFilter">Clear Filter</button>
</div>
<table id="tblMessageDetail" class="display">
<thead>
<tr>
<th>Date 1</th>
<th>Date 2</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="5">Loading....</td>
</tr>
</tbody>
<tfoot></tfoot>
</table>
<div id="pager" class="tab_container">
</div>
</article>
和jQuery代碼:
function renderMsgDetail(result) {
var dtMsgDetailData = [];
$.each(result, function() {
dtMsgDetailData.push([
this.Date1,
this.Date2
]);
});
var oTable = $('#tblMessageDetail').dataTable({
"aaData": dtMsgDetailData,
"aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "ALL"]],
'asStripClasses': null,
"iDisplayLength": 10
});
$("#btnFilterMd").click(function (event) {
event.preventDefault();
alert($('#from').val());
alert($('#to').val());
});
你能提供代碼嗎? – netadictos
任何人?我需要一些幫助 – CSharpNewBee
爲什麼不做ajax調用以便過濾數據?是否有必要在客戶端做? – netadictos