EasyUI treegrid 獲取編輯狀態中某字段的值 [getEditor方法獲取不到editor]


如題,在treegrid里,按照api里getEditor方法的說明,

getEditor
options
Get the specified editor, the options contains two properties:
index: the row index.
field: the field name.

var nameEditor=$('#menuTable').treegrid('getEditor', {id:editingId,field:"name"});

 這樣應該可以取到editor對象,但是測試發現只能獲取到nameEditor=null,測試多次,很是惱火。

后來比較了下datagrid里的getEditor方法,

getEditor
param Get the specified editor, the param contains two properties:
id: the row node id.
field: the field name.

嘗試着把上面treegrid getEditor中的id參數換成了index,值仍然使用id的值,果然,可以獲取到editor對象了,再對此對象進行了一番屬性遍歷之后,終於找到了問題的解決辦法,如下:

var nameEditor=$('#menuTable').treegrid('getEditor', {index:editingId,field:"name"});
var name=nameEditor.target.val();

由此,我敢保證官網api中關於treegrid的getEditor方法的說明是錯誤的,如果我的推測錯誤或者你有更好的思路或者解決辦法,歡迎交流。

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM