日期:2014-05-16 浏览次数:20392 次
<table style="width:783px;" id="mainTable">
<tr class="table_header_bg" height="30px;" align="center" style="text-align:center;">
<th class="table_header_bg">手动排序</th>
<th class="table_header_bg">测试名称</th>
</tr>
<c:forEach items="${testList}" var="test">
<tr class="context" align="center" onmouseover="$(this).addClass('highlight');" onmouseout="$(this).removeClass('highlight');">
<td>
<input type="hidden" value="${test.testId }" />
<input type="text"
numberbox="true"
data-options="required:true,validType:'length[1,6]'"/></td>
<td>${test.testName }</td>
</tr>
</c:forEach>
</table>
function saveTestSort(){
var dataJson="[";
var testId = "";
var testSort = "";
$("tr").each(function (index, domEle){
if(index != 0){
testId = "";
testSort = "";
$(domEle).find("input").each(function(index,data){
if(index == 0){
testId = $(data).val();
}else{
if($(data).val() != "" && $(data).val() != null){
testSort = $(data).val();
}else{
testSort = '0';
}
}
});
dataJson += "{"+"\"testId\":\""+testId+"\","+"\"testSort\":\""+testSort+"\"},";
}
});
alert(dataJson);
};
testId = "";
&nbs