이벤트를 사용하여 편집 가능한 jqGrid가 있지만 편집 URL이 호출되지 않습니다. 데이터 편집은 vb.net의 웹 메소드입니다. 행을 클릭하면 행이 편집 가능 해지고 변경이 가능하지만 Enter 키를 누르면 EditURL이 호출되지 않습니다. 필요한 변경 사항을 제안하십시오. editURL이 호출되지 않음 - JQGrid
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
<WebMethod()> _
Public Shared Function LoadData() As jqGridResult
'If MuList.SelectedValue <> "0" AndAlso MuList.SelectedValue <> String.Empty Then
' hirNodeMu = hirNodeMu.Parse(MuList.SelectedValue)
'Else
' hirNodeMu = 0
'End If
'Dim hirNode As Integer = hirNodeMu
'If hirNode = 0 Then
' hirNode = hirNodeCurrent
'End If
Dim sidx As String = ""
Dim sord As String = "asc"
Dim page As Integer = 1
Dim rows As Integer = 1000
Dim entryFieldsOnly As Integer = 1
Dim hirNode As Integer = 5
Dim fiscalYear As Integer = 2012
Dim fiscalPeriod As Integer = 3
Dim dtWORData As DataTable = New DataTable()
Dim ConnectString As String = ConfigurationSettings.AppSettings("DbConnection")
Using sqlConnection As New SqlConnection(ConnectString)
Dim Conn As SqlConnection = New SqlConnection(ConnectString)
Dim Cmd As SqlCommand = New SqlCommand("finWorFactView", Conn)
Cmd.CommandType = CommandType.StoredProcedure
Cmd.Parameters.Add("@hirNodeBase", SqlDbType.Int, 4).Value = hirNode
Cmd.Parameters.Add("@FiscalYear", SqlDbType.Int, 4).Value = fiscalYear
Cmd.Parameters.Add("@FiscalPeriod", SqlDbType.Int, 4).Value = fiscalPeriod
Cmd.Parameters.Add("@EntryFieldsOnly", SqlDbType.Int, 4).Value = entryFieldsOnly
Conn.Open()
Dim DA As SqlDataAdapter = New SqlDataAdapter(Cmd)
DA.Fill(dtWORData)
End Using
Dim pageIndex As Integer = page
Dim pageSize As Integer = rows
Dim startRow As Integer = (pageIndex * pageSize) + 1
Dim totalRecords As Integer = dtWORData.Rows.Count()
Dim totalPages As Integer = CInt(Math.Ceiling(CSng(totalRecords)/CSng(pageSize)))
Dim row As List(Of jqGridRows) = New List(Of jqGridRows)
For i As Integer = 0 To dtWORData.Rows.Count - 1
Dim newRow As jqGridRows = New jqGridRows
newRow.id = Convert.ToInt32(dtWORData.Rows(i)("DisplayOrder"))
newRow.cell(0) = dtWORData.Rows(i)("DisplayOrder").ToString()
newRow.cell(1) = dtWORData.Rows(i)("ColumnPosition").ToString()
newRow.cell(2) = dtWORData.Rows(i)("ColumnName").ToString()
newRow.cell(3) = dtWORData.Rows(i)("Week1").ToString()
newRow.cell(4) = dtWORData.Rows(i)("Week2").ToString()
newRow.cell(5) = dtWORData.Rows(i)("Week3").ToString()
newRow.cell(6) = dtWORData.Rows(i)("Week4").ToString()
newRow.cell(7) = dtWORData.Rows(i)("Week5").ToString()
newRow.cell(8) = dtWORData.Rows(i)("DbFieldName").ToString()
newRow.cell(9) = dtWORData.Rows(i)("Updateable").ToString()
newRow.cell(10) = dtWORData.Rows(i)("PayrollActive").ToString()
newRow.cell(11) = dtWORData.Rows(i)("PurchasingActive").ToString()
newRow.cell(12) = dtWORData.Rows(i)("hirNode").ToString()
newRow.cell(13) = dtWORData.Rows(i)("finWor1").ToString()
newRow.cell(14) = dtWORData.Rows(i)("finWor2").ToString()
newRow.cell(15) = dtWORData.Rows(i)("finWor3").ToString()
newRow.cell(16) = dtWORData.Rows(i)("finWor4").ToString()
newRow.cell(17) = dtWORData.Rows(i)("finWor5").ToString()
newRow.cell(18) = dtWORData.Rows(i)("finWorP").ToString()
newRow.cell(19) = dtWORData.Rows(i)("Total").ToString()
newRow.cell(20) = dtWORData.Rows(i)("Projection").ToString()
newRow.cell(21) = dtWORData.Rows(i)("HealthCareActive").ToString()
row.Add(newRow)
Next
Dim result As jqGridResult = New jqGridResult
result.total = totalPages
result.page = page
result.records = totalRecords
result.rows = row
Return result
End Function
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
<WebMethod()> _
Public Shared Function EditData(ByVal Week1 As String, ByVal Week2 As String, ByVal Week3 As String, ByVal Week4 As String, _
ByVal Week5 As String, ByVal Projection As String, _
ByVal DbFieldName As String, ByVal hirNode As String, _
ByVal FinWor1 As String, ByVal FinWor2 As String, ByVal FinWor3 As String, ByVal FinWor4 As String, _
ByVal FinWor5 As String, ByVal FinWorP As String, ByVal HealthCareActive As String, _
ByVal oper As String, ByVal id As String) As Boolean
Dim objClass As New _Default
objClass.LogError(Week1 + " " + Week2 + " " + Week3 + " " + Week4 + " " + Week5 + " " + Projection)
Return True
End Function
이
은 방화 내지 - 요청 본문 휴일이 = + 767퍼센트 2C077 + & Week2 = + 7백27% 2C055 + & Week3 = + 7백19퍼센트 2C411 + & Week4 = + 7백38퍼센트 2C102 + & Week5 = + 290퍼센트 2C921 + 투영 = & & 거짓 DbFieldName = 거짓 hirNode = & & FinWor1 = & & FinWor3 FinWor2 = = = & & FinWor4 FinWor5 = + 3 % 2C242 % & FinWorP 2C566 + = + 2 % 2C869 % & HealthCareActive 2C267 + = 거짓 0,123,224 9,OPER = 편집 & ID = 14JS 코드
jQuery(document).ready(function($) {
var lastsel;
$(document).ready(function() {
loadGrid();
});
function loadGrid() {
jQuery("#tblWOR").jqGrid({
url: 'Default.aspx/LoadData',
mtype: 'POST',
datatype: 'json',
ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
serializeGridData: function(postData) {
return JSON.stringify(postData);
},
rowNum: 1000,
width: 1200,
height: 'auto',
colNames: ['Display Order', 'Column P', 'Column N', 'Week1(1-7)', 'Week2(8-14)', 'Week2(15-21)', 'Week1(22-28)', 'Week1(29-31)',
'Total Month' + '</br>' + 'to Date', 'Projection' + '</br>' + 'for Month',
'DbFieldName', 'Updateable', 'PayrollActive', 'PurchasingActive', 'hirNode',
'WOR1', 'WOR2', 'WOR3', 'WOR4', 'WOR5', 'WORP', 'HealthCareActive',
],
colModel: [
{ name: 'DisplayOrder', index: 'DisplayOrder', hidden: true },
{ name: 'CoulumnPosition', index: 'Week1', width: 55 },
{ name: 'ColumnName', index: 'Week1', width: 80 },
{ name: 'Week1', index: 'Week1', width: 55, editable: true, edittype: 'text' },
{ name: 'Week2', index: 'Week2', width: 55, editable: false, edittype: 'text' },
{ name: 'Week3', index: 'Week3', width: 55, editable: false, edittype: 'text' },
{ name: 'Week4', index: 'Week4', width: 55, editable: false, edittype: 'text' },
{ name: 'Week5', index: 'Week5', width: 55, editable: false, edittype: 'text' },
{ name: 'Total', index: 'Total', width: 55 },
{ name: 'Projection', index: 'Projection', width: 55, editable: false, edittype: 'text' },
{ name: 'DbFieldName', index: 'DbFieldName', editable: false, hidden: true },
{ name: 'Updateable', index: 'Updateable', editable: false, hidden: true },
{ name: 'PayrollActive', index: 'PayrollActive', editable: false, hidden: true },
{ name: 'PurchasingActive', index: 'PurchasingActive', editable: false, hidden: true },
{ name: 'hirNode', index: 'hirNode', editable: false, hidden: true },
{ name: 'FinWor1', index: 'FinWor1', editable: false, hidden: true },
{ name: 'FinWor2', index: 'FinWor2', editable: false, hidden: true },
{ name: 'FinWor3', index: 'FinWor3', editable: false, hidden: true },
{ name: 'FinWor4', index: 'FinWor4', editable: false, hidden: true },
{ name: 'FinWor5', index: 'FinWor5', editable: false, hidden: true },
{ name: 'FinWorP', index: 'FinWorP', editable: false, hidden: true },
{ name: 'HealthCareActive', index: 'HealthCareActive', editable: false, hidden: true }
],
pager: '#divWOR',
jsonReader: {
root: "d.rows",
page: "d.page",
total: "d.total",
records: "d.records",
repeatitems: false
},
sortname: 'DisplayOrder',
viewrecords: true,
sortorder: "asc",
onSelectRow: function(DisplayOrder) {
if (DisplayOrder && DisplayOrder !== lastsel) {
jQuery('#tblWOR').jqGrid('restoreRow', lastsel);
jQuery('#tblWOR').jqGrid('editRow', DisplayOrder, true);
lastsel = DisplayOrder;
}
},
cellsubmit: 'remote',
editurl: "Default.aspx/EditData",
caption: "WOR View Grid"
});
jQuery("#tblWOR").jqGrid('navGrid', "#divWOR", { edit: false, add: false, del: false });
}
});
내 코드를 디버그 할 수 있습니다. 데이터가 웹 메서드에 의해 반환되고 있지만 표에 표시되지 않습니다.
이
는serializeGridData
을 추가처럼 당신은 같은 방법으로
serializeRowData
콜백을 추가 할 필요가
{"d":{"__type":"LearnEveryday._Default+jqGridResult","total":1,"page":1,"records":25,"rows":[{"id":3,"cell":["3","2","JWO Revenue"," 921,300 "," 899,595 "," 912,983 "," 941,659 "," 805,100 ","RevenueJwo","False","False","False","0","","","","","",""," 4,480,637 "," 5,378,594 ","False",null]}}
게시 한 코드에 많은 작은 오류가 있습니다. 함수로서'datatype'의 사용법 또한 매우 나쁘고 서버 코드도 오류가 확실합니다 (자세한 정보는 [대답] (http://stackoverflow.com/a/11222278/315935)를보십시오). 귀하의 주요 질문에 : 당신이 쓴 "EditURL 전화되지 않습니다". 어떻게 확인 했니? Fiddler, Firebug, IE의 개발자 도구 또는 HTTP 트래픽을 잡는 다른 도구를 사용 했습니까? "Default.aspx/EditData"메서드에서 중단 점을 설정하면 행을 저장할 필요가 없습니다. 'EditData' 메쏘드의 서명 (어떤 매개 변수)은 무엇입니까? – Oleg
오류의 현지화에 문제가 있다면'LoadData' 코드와'Default.aspx'의'EditData' 코드로 질문을 추가 할 수 있습니다. – Oleg
안녕하세요, 저는 중단 점을 확인하고있었습니다. 방금 방화범이 끌리고 방화범이 불었습니다.LoadData로 작업 할 때 vb 코드를 디버깅 할 수 있었으므로이 시점에서도 중단 점에 도달 할 것으로 생각했습니다. – Arshya