회사에 관하여common.jqgrid.js 파일 연구(미완)
var pageGrid;
$().ready(function(){
var searchUrl = "<c:url value='assessmentSearch.action' />";
var deleteUrl = "<c:url value='assessmentDelete.action' />";
var previousUrl = "<c:url value='assessmentList.action' />";
//
pageGrid = {
gridName : "assessmentListGrid",
formName : "assessmentListForm",
caption : " ",
pagerVar : "assessmentListPager",
searchUrl : searchUrl,
searchParameters : ['searchAssessmentName', 'searchState'],
mutiSelect : false,
colNames : [' ', ' ',' ',' ', ' ','','',' '],
colModel : [
{name : 'assessmentName', index : 'assessmentName',width:'30%'},
{name : 'systemName', index : 'systemName' ,sortable:false,width:'20%'},
{name : 'submitTime', index : 'submitTime',formatter:"date", formatoptions: {newformat:'Y-m-d'},align:'right',width:'10%'},
{name : 'appealEndTiem', index : 'appealEndTiem',formatter:"date", formatoptions: {newformat:'Y-m-d'} ,align : 'right',width:'10%'},
{name : 'state', index : 'state',width:'10%'},
{name : 'stateEn', index : 'stateEn',hidden : true ,width: '10%'},
{name : 'createTime', index : 'createTime',hidden : true ,width: '10%'},
{name : 'operation', index : 'operation',sortable:false,width:'10%'}
],
exportColNames:[],
exportColModel:[],
exportFileName:"",
sortName : "createTime",
sortOrder : "desc",
rowId : "id",
pageCache : "${pageCache}"
};
$.jqgridBuildPageGrid(pageGrid);
<form id="assessmentListForm" action="assessmentList.action" method="post">
<!-- -->
<div class="span-24 last">
<w:nav type="top"/>
</div>
<!-- -->
<div class="span-24 last">
<fieldset>
<legend> </legend>
<table >
<tr>
<td width="10%" class="searchParameterTd">
:
</td>
<td width="40%">
<s:textfield cssClass="text" id="searchAssessmentName" name="searchAssessmentName"/>
</td>
<td width="10%" class="searchParameterTd">
:
</td>
<td width="40%">
<s:select id="searchState" cssClass="select" name="searchState" list="stateList" headerKey="" headerValue=" " listKey="key" listValue="value"></s:select>
</td >
</tr>
</table>
</fieldset>
<fieldset>
<input type="button" value=" " name="searchButton" id="searchButton"/>
<input type="button" value=" " name="resetButton" id="resetButton"/>
<input type="button" value=" " name="createButton" id="createButton"/>
</fieldset>
</div>
<!-- -->
<div class="span-24 last">
<table id="assessmentListGrid"></table>
<div id="assessmentListPager"></div>
<div id="tblMasterMessage"></div>
</div>
</form>
1、$.jqgridBuildPostData 2、$.jqgridSearch 3、$.jqgridSearchButtonClick
페이지 js 호출:
//
$("#searchButton").click(function(){
var startTime = $("#searchAppealStartTime").val();
var endTime = $("#searchAppealEndTime").val();
$.jqgridSearchButtonClick(pageGrid.gridName,pageGrid.searchParameters,searchUrl);
});
common.jqgrid.js의 대응 방법 설명:
$.jqgridSearchButtonClick = function(gridName,searchParameters,searchUrl) {
$.jqgridSearch(gridName,searchParameters,searchUrl,true);
};
$.jqgridSearch = function(gridName,searchParameters,searchUrl,isResetPage) {
//
var postData = $.jqgridBuildPostData(searchParameters);
if(isResetPage == true) {
eval("postData.pageCache=false");
$("#" + gridName).jqGrid("appendPostData",postData);
//
$("#" + gridName).jqGrid("setGridParam",{page:1});
// post
$("#" + gridName).jqGrid("setGridParam",{url:searchUrl}).trigger("reloadGrid");
}
else {
$("#" + gridName).jqGrid("appendPostData",postData);
//
$("#" + gridName).jqGrid("setGridParam",{url:searchUrl}).trigger("reloadGrid");
}
};
// postData
$.jqgridBuildPostData = function(searchParameters) {
// post
var postData = new Object();
//
for(var i = 0 ; i < searchParameters.length; i++) {
var name = searchParameters[i];
var currentValue = $("#" + searchParameters[i]).attr('value');
eval("postData."+name+"=currentValue");
}
return postData;
};
$.jqgridPageButtonClick $.jqgridDeleteButtonClick $.jqgridDeleteButtonClick2
$._jqgridDeleteButtonClick
// ajax
$("#deleteBtn").click(function(){
$.jqgridDeleteButtonClick(messageGrid.gridName,messageGrid.searchParameters,deleteUrl)
});
common.jqgrid.js의 대응 방법 설명:
$.jqgridDeleteButtonClick = function(gridName,searchParameters,deleteUrl) {
var confirmDeleteStr = " ?";
var deleteSuccessStr = " ";
var alertSelectStr = " ";
$.jqgridDeleteButtonClick2(gridName,searchParameters,deleteUrl,confirmDeleteStr,deleteSuccessStr,alertSelectStr);
};
//confirmDeleteStr ,deleteSuccessStr ,alertSelectStr
$.jqgridDeleteButtonClick2 = function(gridName,searchParameters,deleteUrl,confirmDeleteStr,deleteSuccessStr,alertSelectStr) {
var selectIds = $("#" + gridName).jqGrid('getGridParam','selarrrow');
if (selectIds!=null && selectIds!="") {
selectIds = selectIds.join(",");
$._jqgridDeleteButtonClick(gridName,searchParameters,deleteUrl,selectIds,confirmDeleteStr,deleteSuccessStr);
} else{
$.alert(alertSelectStr);
}
};
$.jqgridSingleDeleteButtonClick
$.jqgridSingleDeleteButtonClick2
페이지 js 호출:
$.singleDeleteButtonClick = function (rowId) {
var deleteUrl = "<c:url value='assessmentDelete.action' />";
$.jqgridSingleDeleteButtonClick2(pageGrid.gridName,pageGrid.searchParameters,deleteUrl,rowId," "," ");
//$.jqgridSingleDeleteButtonClick(pageGrid.gridName,pageGrid.searchParameters,deleteUrl,rowId);
}
common.jqgrid.js의 대응 방법 설명:
$.jqgridSingleDeleteButtonClick = function(gridName,searchParameters,deleteUrl,rowId) {
var confirmDeleteStr = " ?";
var deleteSuccessStr = " ";
$.jqgridSingleDeleteButtonClick2(gridName,searchParameters,deleteUrl,rowId,confirmDeleteStr,deleteSuccessStr);
};
$.jqgridSingleDeleteButtonClick2 = function(gridName,searchParameters,deleteUrl,rowId,confirmDeleteStr,deleteSuccessStr) {
$._jqgridDeleteButtonClick(gridName,searchParameters,deleteUrl,rowId,confirmDeleteStr,deleteSuccessStr);
};
//
$._jqgridDeleteButtonClick = function(gridName,searchParameters,deleteUrl,selectIds,confirmDeleteStr,deleteSuccessStr) {
if(confirm(confirmDeleteStr)) {
// postData
var postData = $.jqgridBuildPostData(searchParameters);
eval("postData.selectIds=selectIds");
$("#" + gridName).jqGrid("appendPostData",postData);
postData = $("#" + gridName).jqGrid('getPostData');
$.ajax({
type: 'POST',
url: deleteUrl,
data: postData,
dataType:"json",
success: function (response) {
if(response.message == 'success'){
$.alert(deleteSuccessStr);
//
$("#" + gridName).jqGrid().trigger("reloadGrid");
}
else {
$.alert(response.message);
}
}
});
}
};
$.jqgridDownload $.jqgridExportButtonClick
//
$.exportfile =function(rowId){
var exportUrl = "<c:url value='/assessment/exportAssessment.action'/>";
exportUrl = $.commonBuildUrl (exportUrl,"assessmentId="+rowId);
$.jqgridExportButtonClick(pageGrid.gridName,pageGrid.searchParameters,exportUrl,pageGrid.exportColNames,pageGrid.exportColModel,pageGrid.exportFileName);
};
common.jqgrid.js의 대응 방법 설명:
$.jqgridExportButtonClick = function(gridName,searchParameters,exportUrl,exportColNames,exportColModel,exportFileName) {
// post
var postData = new Object();
//
for(var i = 0 ; i < searchParameters.length; i++) {
var name = searchParameters[i];
var currentValue = $("#" + searchParameters[i]).attr('value');
eval("postData."+name+"=currentValue");
}
// Excel
for(var i = 0 ; i < exportColNames.length; i++) {
var name = exportColNames[i];
eval("postData.exportColNames"+i+"=name");
}
// Excel
for(var i = 0 ; i < exportColModel.length; i++) {
var model = exportColModel[i];
eval("postData.exportColModel"+i+"=model");
}
//
var fileName = exportFileName;
eval("postData.fileName=fileName");
$("#" + gridName).jqGrid("appendPostData",postData);
postData = $("#" + gridName).jqGrid('getPostData');
// , post
$.jqgridDownload(exportUrl, postData, "post", function(){});
};
//
$.jqgridDownload = function(url, data, method, callback){
var inputs = "";
var iframeX;
var downloadInterval;
if(url && data){
// remove old iframe if has
if($("#iframeX")) $("#iframeX").remove();
// creater new iframe
iframeX= $("<iframe src=\"[removed]false;\" name=\"iframeX\" id=\"iframeX\"></iframe>").appendTo("body").hide();
if($.browser.msie){
downloadInterval = setInterval(function(){
// if loading then readyState is “loading” else readyState is “interactive”
if(iframeX&& iframeX[0].readyState !=="loading"){
callback();
clearInterval(downloadInterval);
}
}, 23);
} else {
iframeX.load(function(){
callback();
});
}
//split params into form inputs
$.each(data, function(p, val){
inputs+="<input type=\"hidden\" name='"+ p +"' value='"+ val +"' />";
});
//create form to send request
$("<form action='"+ url +"' method='"+ (method||"post") + "' target=\"iframeX\">"+inputs+"</form>\"").appendTo("body").submit().remove();
};
};
$.jqgridLoadError $.jqgridLoadComplete
$.jqgridGetAllRowData
//
var allRowData = $.jqgridGetAllRowData("typeAndItemListGrid");
$.jqgridSetRowData $.jqgridGetRowData
// operation
$.rowComplete = function(rowId){
var rowData = $.jqgridGetRowData(pageGrid.gridName,rowId);
var operationHtml = '';
// operation
if(rowData.stateEn == '${allocateState}'){
operationHtml += "<input type='button' value=' ' onclick='buttonEditClick(\"" + rowId + "\");'/>";
operationHtml += "<input type='button' value=' ' onclick='$.singleDeleteButtonClick(\"" + rowId + "\")'/>";
//operationHtml += "<input type='button' value=' ' onclick='$.jqgridSingleDeleteButtonClick2(\""+pageGrid.gridName+"\",\""+pageGrid.searchParameters+"\",\""+urldelete+"\",\""+rowId+"\",\" \",\" \");'/>";
} else {
operationHtml += "<input type='button' value=' ' onclick='buttonLookClick(\"" + rowId + "\");'/>";
if (rowData.stateEn == "${endState}") {
operationHtml += "<input type='button' value=' ' onclick= '$.exportfile(\""+rowId+"\")'/>";
}
}
$.jqgridSetRowData(pageGrid.gridName, rowId, {operation : operationHtml});
}
common.jqgrid.js의 대응 방법 설명:
//
$.jqgridSetRowData = function (gridName,rowId,rowData) {
$("#" + gridName).jqGrid('setRowData',rowId,rowData);
};
//
$.jqgridGetRowData = function (gridName,rowId) {
return $("#" + gridName).jqGrid('getRowData',rowId);
};
$.jqgridAddRowData $.jqgridClearGridData $.jqgridReloadGridData $.jqgridDeleteRowData $.jqgridGenerateTempRowId $.jqgridBuildPageGrid $.jqgridSubGridRowComplete $.jqgridSubGridReload $.jqgridBuildSubGrid $.jqgridSelectRow $.jqgridResize $.jqgridIframeResize $.jqgridBuildNonePageGrid $.jqgridReload $.jqgridReloadWithOhterSearchUrl $.jqgridLocalDataGridReload $.jqgridLocalDataGridReloadWithOtherSearchUrl $.jqgridBuildLocalDataGrid $.localDataRowComplete $.jqgridLocalDataDeleteButtonClick $.jqgridLocalDataDeleteButtonClick2 $._jqgridLocalDataDeleteButtonClick $.jqgridLocalDataSingleDeleteButtonClick $.jqgridLocalDataSingleDeleteButtonClick2 $._jqgridLocalDataSingleDeleteButtonClick $.jqgridSetLinkRow $.jqgridSetLinkRowWithOpen
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.