2012-12-11 41 views

回答

1

我不知道我理解你正確的。以任何方式editData是在表格編輯(參見the documentation)的情況下可以使用的財產。如果你需要發送一些額外的信息到服務器extraparamserializeRowData。具體實現取決於您使用內聯編輯的方式。例如,如果你調用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 
     } 
    }); 
} 
+0

+1。但是,使用表單編輯時,是否有其他解決方案? editData方法似乎適用於一個問題。所選ColName單元格的值始終爲false,並且應該是一個字符串。 – thedev

+0

@thedev:您可以在問題的文本中找到文本「我在線編輯」。所以'editData'的用法在這種情況下是錯誤的。如果您使用表單編輯,那麼[答案](http://stackoverflow.com/a/10901920/315935)可能會有所幫助。或者,可以使用表單編輯編輯的'serializeEditData' jqGrid回調或'onclickSubmit'回調。 'onclickSubmit'可以返回具有* additional *參數的對象作爲將被添加到發送給服務器的參數的屬性。 – Oleg

+0

@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

相關問題