0
我正在使用jqGrid,我需要從單元格中發佈一個值,當我進行內聯編輯時,該單元格不可編輯。tot如何從jqGrid中不可編輯的單元格獲取數據?
我試着使用:
editData: {
proiect: jQuery("#Id").getCell(jQuery("#Id").getGridParam('selrow'), 'ColName')
}
我正在使用jqGrid,我需要從單元格中發佈一個值,當我進行內聯編輯時,該單元格不可編輯。tot如何從jqGrid中不可編輯的單元格獲取數據?
我試着使用:
editData: {
proiect: jQuery("#Id").getCell(jQuery("#Id").getGridParam('selrow'), 'ColName')
}
我不知道我理解你正確的。以任何方式editData
是在表格編輯(參見the documentation)的情況下可以使用的財產。如果你需要發送一些額外的信息到服務器extraparam
或serializeRowData
。具體實現取決於您使用內聯編輯的方式。例如,如果你調用editRow
裏面直接的onSelectRow
,那麼你可以在線編輯提示請執行下列操作
onSelectRow: function (id) {
var $this = $(this),
cellValue = $this.jqGrid("getCell", id, 'ColName');
if (id && id!==lastSel){
$this.jqGrid("restoreRow", lastSel);
lastSel = id;
}
$this.jqGrid("editRow", id, {
keys: true,
extraparam: {
proiect: cellValue
}
});
}
+1。但是,使用表單編輯時,是否有其他解決方案? editData方法似乎適用於一個問題。所選ColName單元格的值始終爲false,並且應該是一個字符串。 – thedev
@thedev:您可以在問題的文本中找到文本「我在線編輯」。所以'editData'的用法在這種情況下是錯誤的。如果您使用表單編輯,那麼[答案](http://stackoverflow.com/a/10901920/315935)可能會有所幫助。或者,可以使用表單編輯編輯的'serializeEditData' jqGrid回調或'onclickSubmit'回調。 'onclickSubmit'可以返回具有* additional *參數的對象作爲將被添加到發送給服務器的參數的屬性。 – Oleg
@thedev:查看[行](https://github.com/tonytomov/jqGrid/blob/v4.4.1/js/grid.formedit.js#L659-L662)和[行](https:// github.com/tonytomov/jqGrid/blob/v4.4.1/js/grid.formedit.js#L686)瞭解應該返回的內容[onclickSubmit](http://www.trirand.com/jqgridwiki/doku.php?id= = wiki:form_editing#events)回調。 – Oleg