我想使用提供的链接打开编辑表单。我将如何开始做和修改?我需要采取什么行动来完成这项工作?真的需要这个。必须有一个简单的方法来调用这个动作吗?
所以我尝试做一个“双击”行,但每次插入“datepicker”时都会被禁用,如下所示。所以相反,现在我试图用上面的“编辑项目”链接打开表单编辑器?
<script type="text/javascript">
$(function(){
$("#list").jqGrid({
url:'request.php',
datatype: 'xml',
mtype: 'GET',
height: 350,
colNames:['id','Project', 'Assigned To','Assign Date','Check Date','Due Date','Attachments'],
colModel :[
{name:'id', index:'id', width:20},
{name:'name', index:'name', width:200, align:'left',editable:true, editoptions:{
size:70} },
{name:'id_continent', index:'id_continent', width:80, align:'right',editable:true,edittype:'select',
editoptions:{value: "Henry:Henry; Ramon:Ramon; Paul:Paul" } },
{name:'lastvisit', index:'lastvisit', width:70, align:'right',formatter: 'date',srcformat:'yyyy-mm-dd',newformat: 'm-d-Y',editable:true, edittype: 'text', },
{name:'cdate', index:'cdate', width:80, align:'right',formatter: 'date',srcformat:'yyyy-mm-dd',newformat: 'm-d-Y',editable:true, edittype: 'text',editoptions: {
size: 12,
maxlengh: 12,
dataInit: function (element) {
$(element).datepicker({ dateFormat: 'mm/dd/yy' }
)
}
},
editrules: {
date: true
}
},
{name:'ddate', index:'ddate', width:80, align:'right',formatter: 'date',srcformat:'yyyy-mm-dd',newformat: 'm-d-Y',date:'true',editable:true, edittype: 'text',},
{name:'email', index:'email', width:80,align:'center',sortable:false}
],
pager: '#pager',
rowNum:20,
rowList:[20,40,80],
sortname: 'id',
sortorder: 'desc',
viewrecords: true,
gridview: true,
caption: 'Pending Assignements',
//ondblClickRow: function(rowid) {
//$(this).jqGrid('editGridRow', rowid, {height:300,width:450,reloadAfterSubmit:false,closeAfterEdit:true,closeOnEscape:true});
//}
}).navGrid('#pager', { edit: true,del: true,add:false },
{},//Options for the Edit Dialog
{},//Options for the Add Dialog
{}//Options for Delete
),
jQuery("#list").jqGrid('delGridRow', row_id_s, options );});
</script>
答案 0 :(得分:0)
编辑按钮点击事件:
$('#ButtonName').click(function () { editSelectedRow(); });
自定义功能:
function editSelectedRow() {
//set the grid so we don't have to search the DOM multiple times
var grid = $('#gridName');
//ensure a row is selected
var selectedRow = grid.jqGrid('getGridParam', 'selrow');
if (selectedRow) {
idRowData = grid.jqGrid('getRowData', selectedRow)
grid.jqGrid('editGridRow', 'new', { closeAfterEdit: true, closeAfterSubmit: true, closeAfterAdd: true, recreateForm: true,
viewPagerButtons: false,
editData: { ExtraKeyName: ExtraKeyValue },
afterShowForm: function (formid) {
}, //afterShowForm
afterComplete: function (response) {
} //afterComplete
}); //$this.jqGrid('editGridRow
}
else {
alert("Please select a row);
} //else
}