[英]Get selected row column value extjs grid
我有一個用戶網格。 要刪除一個,請選擇您的行,然后單擊“刪除”按鈕。 但是,這不起作用。 我的代碼是:
var row = userGrid.getSelectionModel().getSelection();
console.log(row.get('dni'))
Firefox說:
TypeError:row.get不是函數
任何想法 ?。
總是檢查hasSelection()
就像是一個好習慣 -
if (userGrid.getSelectionModel().hasSelection()) {
var row = userGrid.getSelectionModel().getSelection()[0];
console.log(row.get('dni'))
}
也許是因為
getSelection():Ext.data.Model []
返回當前所選記錄的數組 。
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.selection.Model-method-getSelection
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.