),editParams沒有發送/處理時鍵設置爲true內嵌網格
我有在使用的jqGrid內聯編輯的問題。我將一些網格從表單編輯切換到內聯編輯。內聯編輯的機制工作正常,但我試圖發送額外的數據返回到服務器時,我保存(我用postData來做到這一點,當我使用表單編輯)。我已經設置editParams發回額外的數據,如果我通過單擊編輯鉛筆編輯記錄並通過單擊導航欄中的保存圖標進行保存,這將起作用。 Howerver,我注意到,當我設置鍵:true時,我可以使用Escape/Enter取消/保存記錄和/或通過雙擊該行啓動記錄編輯,editParams不會被處理/發送到服務器。我認爲這是因爲editParams是在編輯按鈕的點擊事件中設置的 - 我應該如何利用這種方式?
我錯過了什麼嗎?感謝任何幫助我修復我的代碼。
這裏是我的網代碼:
jQuery(document).ready(function() {jQuery('#grdRateEntries')
.jqGrid({
url: 'myUrl',
mtype: 'POST',
datatype: 'xml',
loadonce: false,
editurl: 'myEditUrl',
colNames: [
'ID', '', 'Type', 'Reported', 'Actual', 'Notes', 'Available', 'Paid', 'RateID'],
colModel: [
{name: 'id', index:'id', hidden:true, editable:false, key:true},
{ name: 'act', index: 'act', width: ($.browser.webkit ? 40 : 35), align: 'center', sortable: false, formatter: 'actions',
formatoptions: {
keys: false, // we want to use [Enter] key to save the row and [Esc] to cancel editing.
//delOptions: myDelOptions
delbutton: false,
editbutton: false
}
},
{name:'ddlType', index:'ddlType', width:200, editable:true, edittype:'select', editrules:{required:true}, editoptions:{label:'Type', dataInit:function(el){InitType(el);}, value:':-- Select --;' }},
{name:'ReportedUnits', index:'ReportedUnits', width:200, editable:true, editoptions:{size:10}, editrules:{number:true, required:true}},
{name:'ActualUnits', index:'ActualUnits', width:200, editable:true, editoptions:{size:10}, editrules:{number:true, required:true}},
{name:'Notes', index:'Notes', width:200, editable:true, editrules:{required:true}, editoptions:{rows:'2', cols:'30'}, edittype:'textarea'},
{name:'Available', index:'Available', edittype:'checkbox', width:100, editable:true},
{name:'Paid', index:'Paid', edittype:'checkbox', width:100, editable:false, editoptions:{size:25}},
{name:'TypeID', index:'TypeID', hidden:true, editable:false}
],
recreateForm: false,
multiselect: false,
multiboxonly: false,
pager: jQuery('#pggrdRateEntries'),
rowNum:10,
rownumbers:true,
rowList:[5, 10, 20, 50],
sortname:'Id',
sortorder:'ASC',
viewrecords:true,
grouping:false,
imgpath:'',
caption:'',
autowidth:true,
shrinktofit:false,
toolbar: [true, 'top'],
postData:{entityId:1,employeeid:24,clientid:6},
ondblClickRow: function(id)
{
if(id){ jQuery('#grdRateEntries').jqGrid('restoreRow',lastSel); jQuery('#grdRateEntries').jqGrid('editRow',id,true); lastSel=id; }
},
loadComplete: function()
{
grid.setGridHeight('auto');
grid.setGridWidth(700, false);
var iCol = GetColumnIndexByName($('#grdRateEntries'), 'act');
$(this).find('>tbody>tr.jqgrow>td:nth-child(' + (iCol + 1) + ')')
.each(function(ndx) {
$('<div>', {
title: 'Set Actual=Reported',
mouseover: function() {
$(this).addClass('ui-state-hover');
},
mouseout: function() {
$(this).removeClass('ui-state-hover');
},
click: function(e) {
var selRowId = $(this).parents('tr').attr('id'); //$('#grdRateEntries').jqGrid('getGridParam', 'selrow');
var reportedVal = $('#grdRateEntries').jqGrid('getCell', selRowId, 'ReportedUnits');
$('#grdRateEntries').jqGrid('setCell', selRowId, 'ActualUnits', reportedVal);
}
}
).css({'margin-right': '5px', float: 'left', cursor: 'pointer'})
.addClass('ui-pg-div ui-inline-custom')
.append('<span class="ui-icon ui-icon-copy"></span>')
.prependTo($(this).children('div'));
});
}
});
$('#grdRateEntries').navGrid(
'#pggrdRateEntries',
{
add: false,
edit: false,
del: true,
refresh: true,
search: false,
view: false,
edittitle: 'Edit selected record',
addtitle: 'Add new record',
deltitle: 'Delete selected record',
cloneToTop:true,
closeOnEscape:true
}, // use default settings
grdRateEntrieseditOptions,
grdRateEntriesaddOptions,
grdRateEntriesdeleteOptions, // use default settings for delete
grdRateEntriessearchOptions
);
$('#grdRateEntries').jqGrid('inlineNav',
'#pggrdRateEntries',
{
editParams: {keys: false, extraparam: {entityId:1,employeeid:24,clientid:6}}
}
);
非常感謝任何幫助!
順便說一句,我不是無禮 - 我的問題開始於一個你好,但它被切斷了! :) –