我需要隱藏最後一列,這是複選框基於從彈簧控制器傳遞的模型對象。如果模型值是「isAll」列應該隱藏,如果任何其他值應該是可見的我已經嘗試,但迄今爲止失敗。林不知道我是否正確地從控制器傳遞值。幫幫我!隱藏並顯示錶列
控制器:
System.err.println("Type is: " + formbean.getType());
System.err.println("IscCode is: " + formbean.getForecastIsc());
System.err.println("ActualIscCode is: " + formbean.getActualIsc());
System.err.println("labelNbr is: " + formbean.getLabelNbr());
System.err.println("senderOp is: " + formbean.getSenderOp());
System.err.println("senderLastName is: " + formbean.getSenderLastName());
System.err.println("receiverOp is: " + formbean.getReceiverOp());
System.err.println("receiverLastName is: " + formbean.getReceiverLastName());
summary = summarySelectDao.getSummary(formbean);
if(summary == null || summary.size() == 0){
errorMessage = "No Parcel Analysis Cases Found!";
return new ModelAndView("redirect:/analysis/analysisSelection? hasError=true");
}else{
logger.info("Total " + summary.size() + " analysis cases found from DB.");
model.addObject("summary", summary);
model.addObject("isAll", true); //BASED on this model if true
}
return model;
JSP:
<td class="ct"<c:out value="${summary.country}" /></td>
<td class="sc" <c:out value="${summary.source}" /></td>
<td class="cb" <input type="checkbox" value=""> </td>
JS:
$(document).ready(function() {
$(".cb").hide();
});
HTML:
<div id=table1>
<table id="summaryTable" class="sortable">
<thead>
<tr>
<th> </th>
<th>Bar Code</th>
<th>Origin</th>
<th>Sender Name</th>
<th>Recipient Name</th>
<th>USPS Mail<br>Receipt Date</th>
<th><br>Load Date</th>
<th>Fore-<br>cast<br> ISC</th>
<th>Act-<br>ual<br> ISC</th>
<th>Country</th>
<th>Source</th>
<th class="cb"><input type="button" id="btnSelectAllCbl" name="selectCheckBox"
value="Update"> </th>
</tr>
</thead>
<tbody>
<tr>
<tr>
<td bgcolor='yellow'>P
</td>
<td bgcolor='yellow'><a href="AnalysisController?value=xxxxx">xxxxx
</a>
</td>
<td bgcolor='yellow'>55025
</td>
<td bgcolor='yellow'>xxxx
</td>
<td bgcolor='yellow'>SON
</td>
<td bgcolor='yellow'>
</td>
<td bgcolor='yellow'>2013/02/11 060205
</td>
<td bgcolor='yellow'>ORD
</td>
<td bgcolor='yellow'>ORD
</td>
<td bgcolor='yellow'>SINGAPORE
</td>
<td bgcolor='yellow'>RECIPIENT
</td>
<td class="cb" bgcolor='yellow'><input
type="checkbox" value="">
</td>
你根本沒有顯示HTML,或只是沒有隱藏最後一列?如果您嘗試在單元格中顯示值,我認爲JSP中的HTML無效。您需要在
2013-03-13 21:12:35
它應該在正確關閉時工作,請點擊此處查看:http://jsfiddle.net/D2LR3/ – gnysek 2013-03-13 21:15:39
對不起,可能會讓我困惑一下。隱藏功能工作正常,但我需要的是,它只隱藏列時,從控制器傳遞的值是「isAll」,否則它應該顯示該列,現在它隱藏列,即使「isAll」爲假 – Fahad 2013-03-13 21:33:24