获取struts迭代list在页面显示的数据
js代码:
function modifyPactMoney(){ var table=$("#pactfee"); var trs=table.find("tr"); //先把保证金的重算 for(var i=0;i<trs.length;i++){ var feerate=$("#pactfee").find("[name='pactfeelist["+i+"].feerate']:last"); var feetype=$("#pactfee").find("[name='pactfeelist["+i+"].feetype']:last"); var feeratename=$(feerate).attr("name"); var feetypeval=$(feetype).val(); if(feeratename!=null && feeratename!=undefined && feetypeval=='301'){ checkfeewill(feerate); } } //然后再算其他的费用,因为其他费用是需要减掉保证金的 for(var i=0;i<trs.length;i++){ var feerate=$("#pactfee").find("[name='pactfeelist["+i+"].feerate']:last"); var feetype=$("#pactfee").find("[name='pactfeelist["+i+"].feetype']:last"); var feeratename=$(feerate).attr("name"); var feetypeval=$(feetype).val(); if(feeratename!=null && feeratename!=undefined && feetypeval!='301'){ checkfeewill(feerate); } } }
jsp代码:
<tr> <td width="20%" class="td_left" style="align-text:center;">保函费用及<br/>保证金标准</td> <td colspan="3"> <table class="report_table" style="width:100%" id="pactfee"> <tr> <td style="width:18px;align-text:center;"> <img src="<s:url value="/images/report/grid_tool_add.gif"/>" onclick="myinsertRow($(this).parent().parent().parent().parent(),'pactfeelist',/(pactfeelist\[\d{1,}\])/ig,1,1);" ALT="新增费用" /> </td> <td style="width:20%;text-align:center;" >收费种类</td> <td style="width:20%;text-align:center;" >收费方式</td> <td style="width:20%;text-align:center;" >比率(费率/利率)%</td> <td style="width:20%;text-align:center;" >应收费用(元)</td> <td style="text-align:center;" >币种</td> </tr> <tr name="pactfeelist" style="display:none"> <td> <img src="<s:url value="/images/report/grid_tool_del.gif" />" onclick="deleteRow($(this).parent().parent());modifyPactMoney();" /> <input type="hidden" name="pactfeelist[0].projid" value="<s:property value="projid"/>" disabled="true"/> <input type="hidden" name="pactfeelist[0].feepactid" value="" disabled="true"/> </td> <td> <dict:select dictTypeId="BMS_VOUCHER_TYPE" onblur="checkDefault($(this));" name="pactfeelist[0].feetype" value="" cssClass="easyui-validatebox feetype" rule="required:true" disabled="true"/> </td> <td> <dict:select dictTypeId="BMS_FEE_METHOD" name="pactfeelist[0].feemethod" value="" cssClass="easyui-validatebox" rule="required:true" disabled="true"/> </td> <td> <input type="text" id="pactfeelist[0].feerate" name="pactfeelist[0].feerate" onblur="modifyPactMoney();" onfocus="checkPactMoney();" disabled="true" class="easyui-validatebox feerate" data-options="required:true,validType:'number'" style="width:120px;"/> </td> <td> <input type="text" id="pactfeelist[0].feewill" onblur="allFeeSum();" name="pactfeelist[0].feewill" disabled="true" class="easyui-validatebox feewill" data-options="required:true,validType:'number'" style="width:120px;"/> </td> <td> <dict:select dictTypeId="BMS_REGCURRID_TYPE" name="pactfeelist[0].currency" defultValue="001" value="" cssClass="easyui-validatebox" rule="required:true" disabled="true"/> </td> </tr> <s:if test="!pactfeelist.isEmpty"> <s:iterator value="pactfeelist" var="feeInfo" status="stus"> <tr name="pactfeelist"> <td> <img src="<s:url value="/images/report/grid_tool_del.gif" />" onclick="deleteRow($(this).parent().parent());modifyPactMoney();" /> <input type="hidden" name="pactfeelist[<s:property value="#stus.index + 1"/>].projid" value="<s:property value="projid"/>"/> <input type="hidden" name="pactfeelist[<s:property value="#stus.index + 1"/>].feepactid" value="<s:property value="feepactid"/>"/> </td> <td> <dict:select dictTypeId="BMS_VOUCHER_TYPE" onblur="checkDefault($(this));" name="pactfeelist[%{#stus.index + 1}].feetype" value="#feeInfo.feetype" cssClass="easyui-validatebox feetype" rule="required:true"/> </td> <td> <dict:select dictTypeId="BMS_FEE_METHOD" name="pactfeelist[%{#stus.index + 1}].feemethod" value="#feeInfo.feemethod" cssClass="easyui-validatebox" rule="required:true"/> </td> <td> <input type="text" id="pactfeelist[<s:property value="#stus.index + 1"/>].feerate" name="pactfeelist[<s:property value="#stus.index + 1"/>].feerate" onblur="modifyPactMoney();" onfocus="checkPactMoney();" value="<v:property value="feerate" number="true"/>" class="easyui-validatebox feerate" data-options="required:true,validType:'number'" style="width:120px;"/> </td> <td> <input type="text" id="pactfeelist[<s:property value="#stus.index + 1"/>].feewill" name="pactfeelist[<s:property value="#stus.index + 1"/>].feewill" onblur="allFeeSum();" value="<v:property value="feewill" number="true"/>" class="easyui-validatebox feewill" data-options="required:true,validType:'number'" style="width:120px;"/> </td> <td> <dict:select dictTypeId="BMS_REGCURRID_TYPE" name="pactfeelist[%{#stus.index + 1}].currency" value="#feeInfo.currency" cssClass="easyui-validatebox" rule="required:true"/> </td> </tr> </s:iterator> </s:if> <s:else > <tr name="pactfeelist"> <td> <img src="<s:url value="/images/report/grid_tool_del.gif" />" /> <input type="hidden" name="pactfeelist[0].projid" value="<s:property value="projid"/>"/> <input type="hidden" name="pactfeelist[0].feepactid" value="<s:property value="feepactid"/>"/> </td> <td> <dict:select dictTypeId="BMS_VOUCHER_TYPE" onblur="checkDefault($(this));" name="pactfeelist[0].feetype" cssClass="easyui-validatebox feetype" rule="required:true"/> </td> <td> <dict:select dictTypeId="BMS_FEE_METHOD" name="pactfeelist[0].feemethod" cssClass="easyui-validatebox" rule="required:true"/> </td> <td> <input type="text" id="pactfeelist[0].feerate" name="pactfeelist[0].feerate" onblur="modifyPactMoney();" onfocus="checkPactMoney();" class="easyui-validatebox feerate" data-options="required:true,validType:'number'" style="width:120px;"/> </td> <td> <input type="text" id="pactfeelist[0].feewill" name="pactfeelist[0].feewill" onblur="allFeeSum();" class="easyui-validatebox feewill" data-options="required:true,validType:'number'" style="width:120px;"/> </td> <td> <dict:select dictTypeId="BMS_REGCURRID_TYPE" name="pactfeelist[0].currency" defultValue="001" cssClass="easyui-validatebox" rule="required:true"/> </td> </tr> </s:else> </table> <table width="100%"> <tr> <td width="64%" align="right">合计收费:</td> <td > <span id="allFeeSum"></span>元 <input type="hidden" id="baseInfoBZJFeeRate" value=""/> </td> </tr> </table> </td> </tr>