我是Liferay的新手。 我的问题是我在searchcontainer中使用复选框,当我使用分页并转到下一页时。我找不到上一页选中的复选框的复选框值。
这里是我的JSP代码:
<portlet:resourceURL var="approvedREMSURL" id="approveBtn">
<portlet:param name="action" value="Approval"/>
<portlet:param name="reimHistoryId" value="0"/>
</portlet:resourceURL>
//AJAX CALL
$('.approveBtn').on("click", function(){
var reimbursementIds = [];
$('.selectedChk').each(function(index) {
if($(this).is(':checked')){
reimbursementIds.push($(this).data("reimids"));
}
});
var remsIds = JSON.stringify(reimbursementIds);
$.ajax({
url : '${approvedREMSURL}',
data : {
remsIds : remsIds
},
success: function(data){
if($('input[type="checkbox"]:checked').length > 0){
alert("IDS " + remsIds);
alert(data);
var var1 = JSON.parse(data);
if( var1.userRole === 'Business Unit'){
alert("Inside BU Loop");
$("#<portlet:namespace />buApproveId").val(var1.buApproveId);
}else if(var1.userRole === 'Accounts'){
alert("Inside accounts loop");
$("#<portlet:namespace />accountsApproveId").val(var1.accountsApproveId);
}
location.reload();
}else{
alert("Please, select at least one checkBox!!");
}
},
error: function (error) {
console.log("Failure Come ERROR ! ! :- ");
}
});
});
//SEARCHCONTAINER CODE
<liferay-ui:search-container searchContainer="${reimbursementBusinessUnitSearchContainer}">
<liferay-ui:search-container-results results="${reimbursementBusinessUnitSearchContainer.getResults()}"/>
<liferay-ui:search-container-row
className="com.intraHrms.rems.service.custom.model.ReimbursementDetailsWrapper"
modelVar="ReimbursementDetailsWrapper" keyProperty="reimbursementid">
<c:set var="reimId" value="${ReimbursementDetailsWrapper.reimbursementid}"/>
<c:set var="remStatus" value="${ReimbursementDetailsWrapper.statusName}"/>
<%
String demo = (String)pageContext.getAttribute("reimId");
String encodeId = Base64.getEncoder().encodeToString(demo.getBytes());
%>
<liferay-portlet:renderURL var="viewURL" plid="${plId}" portletName="com_intrahrms_reimbursementDetails_web_portlet_ReimbursementDetailsWebPortlet">
<liferay-portlet:param name="reimbursementId" value="<%=encodeId%>" />
<liferay-portlet:param name="reimbursementStatus" value="${ReimbursementDetailsWrapper.statusName}"/>
</liferay-portlet:renderURL>
<liferay-ui:search-container-column-text>
<c:choose>
<c:when test="${remStatus == 'Business Unit Approval'}">
<input type="checkbox" class="selectedChk" data-reimids="<%=demo%>"/>
</c:when>
<c:otherwise>
<input type="checkbox" disabled/>
</c:otherwise>
</c:choose>
</liferay-ui:search-container-column-text>
......
这是我的服务资源代码。
if (Validator.isNotNull(resourceRequest.getResourceID())
&& "approveBtn".equalsIgnoreCase(resourceRequest.getResourceID())) {
String rems = req.getParameter("remsIds");
我正在获得rems的价值。 当分页再次调用时,我想再次使用此rems