在數據表上的datepicker有一些麻煩。我已經在頁面頂部設置了兩個測試日期選擇器,它們工作正常。jquery datatables中的日期選擇器不工作
但是,我的問題是,當我在我的aColumns中選擇'{type:"date-range"}
時,出現一個錯誤,告訴我from.datepicker()
不是函數。
我試過所有其他類型的過濾器(選擇,數量範圍等),除日期範圍外,所有過濾器都正常工作。
任何人都可以幫助我爲什麼我的JavaScript似乎打破使用類型:「日期範圍」。我似乎無法弄清楚,爲什麼它不會像這裏顯示http://jquery-datatables-column-filter.googlecode.com/svn/trunk/dateRange.html
的例子中工作下面是代碼
<body>
<div id="content">
</div><div id='assignments_view'>
<h1>Assignments</h1><br/>
From:<input type="text" name="start_date" value="" id="dateStart" placeholder="start Date" /><br/>
To:<input type="text" name="end_date" value="" id="dateEnd" placeholder="End Date" /><br/>
<button id = "addNewAssignmentButton">Add New Assignment</button>
<div id="assignmentTableDiv">
<table id="assignmentTable" class="fht-table" >
<thead>
<tr>
<th>Name</th>
<th>Basic Information</th>
<th>Submitter</th>
<th>Status</th>
<th>Area</th>
<th>Start Date</th>
<th>End Date</th>
<th>Shopping Cart</th>
<th>Purchase Order</th>
</tr>
</thead>
<tbody>
<tr class = "assignmentRow" ondblclick="document.location = 'assignments/load_individual_assignment_view/21 '">
<td>Test assignment</td>
<td>basic Info for test assignment</td>
<td class = 'status'>review</td>
<td>2013-01-08</td>
<td>2013-01-01</td>
</tr>
</tbody>
<tfoot><tr class = "footer">
</tr></tfoot>
</table>
</div>
</div>
<script
src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="http://localhost/ahb/js/libs/jquery-1.7.1.min.js"><\/script>')</script>
<script src="http://localhost/ahb/js/libs/jquery-ui-1.8.20.custom.min.js"></script>
<script>
$(document).ready(function() {
var oTable = $('#assignmentTable')
.dataTable(
{
"bJQueryUI": true,
}
)
.columnFilter({ sPlaceHolder: "head:before",
aoColumns: [ null,null,{type:"select"},null,null,
null,
{type:"date-range"},
null,
null,
]}
);
});
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="http://localhost/ahb/js/libs/jquery-1.7.1.min.js"><\/script>')</script>
<script src="http://localhost/ahb/js/libs/jquery-ui-1.8.20.custom.min.js"></script>
<script>
$('#dateStart').datepicker({ dateFormat: "yy-mm-dd" });
$('#dateEnd').datepicker({ dateFormat: "yy-mm-dd" });
</script>
<div id="footer">
<footer>
Page rendered in <strong>0.0951</strong> seconds
</footer>
</div>
<!-- JavaScript at the bottom for fast page loading -->
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="http://localhost/ahb/js/libs/jquery-1.7.1.min.js"><\/script>')</script>
<!-- scripts concatenated and minified via build script -->
<script src="http://localhost/ahb/js/plugins.js"></script>
<script src="http://localhost/ahb/js/script.js"></script>
<script src="http://localhost/ahb/js/jquery-placeholder.js"></script>
<script src="http://localhost/ahb/js/libs/jquery.dataTables.min.js"></script>
<script src="http://localhost/ahb/js/libs/jquery.dataTables.columnFilter.js"> </script>
<script src="http://localhost/ahb/js/libs/tabletools.js"></script>
<!-- end scripts -->
</body>
</html>
你可以削減你的代碼到什麼實際相關? –
我已經刪除了大部分不相關的代碼,只留下了表格和腳本。 – KeithC