controlled saving in jqgrid cell editing
that's about it
Basically what I want to do is control the cell submission with a button or any other control.
Has anyone done this?
Here's some code to help:
$('#users').jqGrid({
url : base_url + 'administrator/ajaxuser',
datatype : 'json',
mtype : 'GET',
colNames : ['ID', 'E-mail' , 'First Name', 'Last Name','Role' ,'Active', 'Action'],
colModel : [
{name: 'id', index: 'id', resizable: false},
{name: 'email', width: 400, index : 'email', editable:true, editrules : {email:true, required:true, custom:true, custom_func:check_email_exists}},
{name: 'firstname', index:'firstname'},
{name:'lastname', index:'lastname'},
{name:'role', index:'role_id', editable: true, width:180, edittype: 'select', editoptions : {value :'1:administrator;3:special;2:user'}},
{name:'active', index:'is_active', editable: true, width:180, edittype: 'select', editoptions : {value :'0:Not Active;1:Active'}},
{name: 'action', index: 'action'}
],
cellEdit : true,
editurl : base_url + 'administrator/ajaxuseredit',
cellurl : base_url开发者_JAVA技巧 + 'administrator/ajaxuseredit',
beforeSaveCell : function(id, cell, value){
alert(cell);
},
pager : '#pager',
emptyrecords: 'Nothing to display',
rowNum : 3,
rowList : [3, 5, 7],
sortname : 'email',
viewrecords : true,
caption : 'Payments Made',
autowidth: true,
multiselect : true,
loadError : function(xhr, st, err){
}
}).navGrid('#pager', {edit:false, add:false});
$('#users').jqGrid('saveCell', 'Row', 'iCol');
Use row edit instead of cell edit and look at the "Full control" demo. Then change the row edit config to make only the cell you want editable.
精彩评论