ฉันมีช่องทำเครื่องหมายในตาราง html เมื่อใช้ knockoutjs ฉันกำลังผูกตาราง html ของฉันกับวัตถุ json จนถึงตอนนี้ทุกอย่างทำงานได้ดี แต่เมื่อฉันใช้ตัวเรียงลำดับตาราง ช่องทำเครื่องหมายที่เลือกไว้ก่อนหน้านี้จะไม่ถูกเลือก มันเกิดขึ้นหลังจากการเรียกฟังก์ชัน Buildtable() จากโค้ดที่แสดงด้านล่าง เบราว์เซอร์ที่ฉันใช้คือ IE6 ไม่แน่ใจว่าเป็นปัญหาของเบราว์เซอร์หรือไม่ ไม่สามารถเข้าถึงเบราว์เซอร์อื่นได้ในขณะนี้ ความช่วยเหลือใด ๆ ที่จะได้รับการชื่นชม
ขอบคุณ
<div id="unassignedDiv" style="text-align:center;display:none;">
<table class="tablesorter" id="unassignedTable">
<thead><tr>
<th align="center">Date</th>
<th align="center">Rush?</th>
</thead></tr>
<tbody id="resultsbody" data-bind="template: { name: 'resultsTemplate', foreach: Results }"></tbody></table>
<script id="resultsTemplate" type="text/html">
<tr><td data-bind="text: dateneeded" align="center"></td>
<td align="center">
<input type="checkbox" data-bind="checked:rushindicator" disabled="disabled" />
</td>
</tr>
</script>
</div>
//Build JsonObject
BuildArray = function () {
var searchjson = {
"Results": [
{ "dateneeded": "11/08/12", rushindicator: true },
{ "dateneeded": "11/10/12", rushindicator: false }]};
};
BuildResultsPage = function () {
$j('#unassignedDiv').show();
var resultArray = BuildArray();
exported.viewmodelExpanded = ko.mapping.fromJS(resultArray);
ko.applyBindings(exported.viewmodelExpanded, $j('#unassignedDiv')[0]);
BuildTable(); //If this is commented, html loads checkbox with checked.
};
BuildTable = function () {
$j("#unassignedTable").tablesorter({ widgets: ['zebra'], widgetZebra: { css: ["oddcolor", "evencolor"] },
sortInitialOrder: 'desc',
headers:
{
0: { sorter: 'Date' },
1: { sorter: false }
}
}).tablesorterPager({ container: $j("#pager"), removeRows: true });
};