这是我的第一篇文章,如果我做错了什么/不理想,请告诉我。
我有一个 igGrid,它通过生成的 html 代码使一列成为标签。如果该行不可编辑,这将非常有用。我在同一行中也有一列我希望能够编辑。如果我允许对行进行编辑,则标记不再起作用,因为对行的任何单击都会使该行进入编辑模式。有没有办法只允许编辑一列?我已禁用我不想编辑的列的编辑,但单击其中任何一个仍会使整行进入编辑模式,只有允许的列是可编辑的。
示例行可能如下所示:
Filename = "<a href='path/Permit/DownloadFile?permitFileID=23'>filename.txt</a>"
Note = "file notes"
Email = "email@gmail.com"
AddedTime = "2013/05/14"
PermitFileID = "23"
我希望能够编辑注释列并且仍然能够单击文件名列。
这是我的代码:
$(document).ready(function()
{
$('#attachedFilesGrid').igGrid(
{
columns:
[
{ headerText:"File Name", key: "FileName", dataType: "text"},
{ headerText:"Notes", key:"Note", dataType:"text"},
{ headerText:"Uploaded By", key:"Email", dataType:"text"},
{ headerText:"Date", key:"AddedTime", dataType:"date", format: "yyyy/MM/dd"},
{ headerText:"ID", key:"PermitFileID", dataType:"number"},
],
width:'700px',
dataSource: fileList,
autoCommit:true,
primaryKey:"PermitFileID",
features:
[{
name:"Updating",
enableDeleteRow:true,
rowDeleting:function(evt, ui)
{
$.post(BASEURL + "Permit/deleteFile", { "permitFileID": ui.rowID});
},
editRowEnded:function(evt, ui)
{
note = $("#attachedFilesGrid").igGrid( "getCellText", ui.rowID, "Note");
$.post(BASEURL + "Permit/updatePermitFileNotes", { "permitFileID": ui.rowID, "note": note });
},
enableAddRow:false,
editMode:"row",
columnSettings: [
{ columnKey:"FileName", editorOptions: { disabled: true} },
{ columnKey:"Note", editorOptions: { disabled: false} },
{ columnKey:"Email", editorOptions: { disabled: true} },
{ columnKey:"AddedTime", editorOptions: { disabled: true} },
{ columnKey:"PermitFileID", editorOptions: { disabled: true} },
]
},