YUI 2.7.0を使用していますが、クライアント側のページ付けを停止し、サーバー側のページ付けを停止しようとしています(クエリは数千の結果を返す可能性があります)。現在、結果は表示されていません(「レコードが見つかりません。」というメッセージが表示されます)。ウェブ上で答えが見つからないようです。alert()を呼び出すと正しい番号が表示されるので、サーバーから何かが返されていることがわかります。問題はjobsCallbackまたはhandleDataReturnPayloadにあると思われますが、そこからスタックしています。ヒントはありますか?
function jobStatusFormatter(elCell, oRecord, oColumn, oData)
{
var messages =
[
<c:forEach var="x" begin="0" end="17">
"<fmt:message key="job.status.${x}"/>",
</c:forEach>
];
elCell.innerHTML = messages[oData];
}
var jobColumns =
[
{key:"lotNumber", label:"<fmt:message key="job.lotNumber"/>", sortable:true},
{key:"scheduledStartDate", label:"<fmt:message key="job.startDate"/>", sortable:true, formatter:"date"},
{key:"scheduledCompletionDate", label:"<fmt:message key="job.completionDate"/>", sortable:true, formatter:"date"},
{key:"itemNumber", label:"<fmt:message key="job.itemNumber"/>", sortable:true},
{key:"statusType", label:"<fmt:message key="job.statusType"/>", sortable:true, formatter:jobStatusFormatter},
{key:"plannerCode", label:"<fmt:message key="job.plannerCode"/>", sortable:true},
{key:"scheduledGroup", label:"<fmt:message key="job.scheduledGroup"/>", sortable:true},
{key:"organization", label:"<fmt:message key="job.organization"/>", sortable:true}
];
var jobsDataSource = new YAHOO.util.DataSource("<%=request.getContextPath()%>/secure/xml/jobs.do?");
jobsDataSource.connMethodPost = true;
jobsDataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
jobsDataSource.responseSchema =
{
resultNode: "job",
fields:
[
"id",
"lotNumber",
"plannerCode",
"scheduledGroup",
"scheduledStartDate",
"scheduledCompletionDate",
"itemNumber",
"statusType",
"organization"
],
metaNode: "jobs",
metaFields:
{
totalResultsAvailable : "totalResultsAvailable",
totalResultsReturned : "totalResultsReturned"
}
};
var jobsConfigs =
{
initialLoad: false,
dynamicData: true,
paginator: new YAHOO.widget.Paginator(
{
rowsPerPage:15,
rowsPerPageOptions : [15,25,50,100]
})
};
var jobsTable = new YAHOO.widget.DataTable("jobsDiv", jobColumns, jobsDataSource, jobsConfigs);
jobsTable.subscribe("rowMouseoverEvent", jobsTable.onEventHighlightRow);
jobsTable.subscribe("rowMouseoutEvent", jobsTable.onEventUnhighlightRow);
jobsTable.set("selectionMode","single");
jobsTable.subscribe("rowClickEvent", function(args)
{
var target = args.target;
var record = this.getRecord(target);
window.location="job.do?id="+record.getData("id");
});
jobsTable.handleDataReturnPayload = function(oRequest, oResponse, oPayload)
{
alert("totalResultsAvailable="+oResponse.meta.totalResultsAvailable+", totalResultsReturned="+oResponse.meta.totalResultsReturned);
oPayload.totalRecords = oResponse.meta.totalResultsAvailable;
return oPayload;
};
var jobsCallback =
{
success : jobsTable.onDataReturnInitializeTable ,
failure : jobsTable.onDataReturnInitializeTable ,
scope : jobsTable
};
function getQueryParams()
{
var form = document.forms[0];
var lotNumber = form.lotNumber.value;
var itemNumber = form.itemNumber.value;
var plannerCode = form.plannerCode.value;
var scheduledGroup = form.scheduledGroup.value;
var statusType = form.statusType.value;
var organization = form.organization.value;
return "lotNumber="+lotNumber+
"&itemNumber="+itemNumber+
"&statusType="+statusType+
"&plannerCode="+plannerCode+
"&scheduledGroup="+scheduledGroup+
"&organization="+organization;
}
/* Called when submit button pressed */
function findJobs()
{
// Sends a request to the DataSource for more data
jobsTable.showTableMessage(YAHOO.widget.DataTable.MSG_LOADING);
jobsDataSource.sendRequest(getQueryParams(), jobsCallback);
}