这是我拥有的主要jsp,这个jsp在页面中显示1000个配置文件,因为我们可以看到显示表中的pagesize被硬编码为1000.
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib uri="http://displaytag.sf.net" prefix="display"%>
<link href="css/displaytag.css" type="text/css" rel="stylesheet">
<SCRIPT TYPE="text/javascript"><!--
/* Function to check/uncheck all candidates */
function checkUncheckAll(theElement) {
var theForm = theElement.form;
for(var z = 0; z < theForm.length; z++) {
if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
theForm[z].checked = theElement.checked;
}
}
}
/* Enables the Acquire button if any candidate is selected */
function checkSelectedCandidates() {
var acquireButton = document.getElementById("acquireButton");
var candidates = document.candidateResultsForm.candidates;
var foundCheckedCandidate = false;
if (candidates) {
if (candidates.length) {
for (var i = 0; i < candidates.length; i++) {
if (candidates[i].checked) {
foundCheckedCandidate = true;
break;
}
}
} else {
foundCheckedCandidate = candidates.checked;
}
}
if (foundCheckedCandidate) {
acquireButton.disabled = false;
} else {
acquireButton.disabled = true;
}
return false;
}
--></SCRIPT>
<form name="candidateResultsForm" action="ManageVettingQueue?command=ACQUIRE_CANDIDATES" method="POST" onsubmit="showProgressBar();">
<s:if test="ewCandidateList != null">
<input id="acquireButton" type="submit" value="Acquire" class="button" disabled="disabled" />
<div id="displayTableHolder" class="displayTableHolder"></div>
<display:table id="displayTable" name="ewCandidateList" sort="list" pagesize="1000" requestURI="CandidateSearchResult"
decorator="com.thomsonreuters.legal.lem.lpa.ui.decorator.EWCandidateSearchResultDecorator">
<s:if test="%{#session.userAuthorization.acquireExpertCandidate}">
<display:column property="checkBox"
title="<input type='checkbox' name='checkall' onclick='checkUncheckAll(this);checkSelectedCandidates();'/>" />
</s:if>
<display:column property="lastName" title="Last Name" sortable="true" />
<display:column property="firstName" title="First Name" sortable="true" />
<display:column property="middleName" title="Middle Name" sortable="true" />
<display:column property="profSuffix" title="Prof. Suffix" sortable="true" />
<display:column property="jobTitle" title="Job Title" />
<display:column property="areaOfExpertise" title="Area Of Expertise" />
<display:column property="city" title="City" sortable="true" />
<display:column property="state" title="State" sortable="true" />
<display:column property="country" title="Country" sortable="true" />
<display:column property="orgName" title="Org. Name" sortable="true" />
</display:table>
<script type="text/javascript">
// If any candidate is found, collapse the filter criteria section
if (document.candidateResultsForm.candidates) {
hideFilterCriteria();
}
</script>
<script language="JavaScript" type="text/javascript" src="js/displaytag.js"></script>
<script type="text/javascript">showProgressBarOnAnchorClick(document.getElementById("displayTable"));</script>
</s:if>
</form>
* 我想要的是...... *
我想将该硬编码值设置为动态,为此我想通过select标签创建一个下拉列表作为示例:
<div id="settingPageSize" align = "left"><select id="pageCount">
<option value="50">50</option>
<option value="100">100</option>
<option value="150">150</option>
<option value="200">200</option>
<option value="250">200</option>
<option value="500">200</option>
</select></div>
并且在pagesize值(1000)的位置我将调用一个JavaScript方法,它将通过返回调用位置从下拉列表中为我们提供所选项的值,因为我们从pagesize调用javaScript方法,因此动态值将在那里出发。
例如,Java Script方法是:
/* Return the value selecte from the drop down list */
function selectPageSize() {
var selectBox = document.getElementById("pageCount");
var selectedValue = selectBox.options[selectBox.selectedIndex].value;
return selectedValue;
}
在i中设置pagesize =“selectPageSize();”
但它无法正常工作 告诉我这个问题 如果有的话,给我任何其他解决方案。 提前致谢 问候 ANKUR