Extjs GridPanel 幾點說明,extjsgridpanel

來源:互聯網
上載者:User

Extjs GridPanel 幾點說明,extjsgridpanel

1. 在Ext中,表格控制項必須包含列定義資訊,並指定表格的資料存放區器。列資訊由columns定義,而資料存放區器有store定義。

2. store負責把各種各樣的未經處理資料(JSON對象數組等等)轉換成Ext.data.Record類型的對象。

    包含兩部分的資訊:proxy和reader。proxy指定擷取資料的方式,reader是指如何解析這一堆資料。

簡單store 模板代碼

var store = Ext.data.Store({proxy : {type : "ajax",url : "",reader : {type : "json",totalProperty : "count",root : "root",idProperty : "id"}},fields : [{name : 'id', mapping : "id"},{name : 'name', mapping : "name"},{name : "desc", mapping : 'description'}]});



後台得到extjs中gridpanel選中行的某個值

function deletefileItems() {
var gsm = fileGrid.getSelectionModel();//擷取選擇列
var rows = gsm.getSelections();//根據選擇列擷取到所有的行
if (rows.length > 0) {
//當有選擇的資料的時候
for (var i = 0; i < rows.length; i++) {
//迴圈迭代所有的選擇的row
var row = rows[i];
var filePath = row.get('filePath');//這個就是你想要的
Ext.Ajax.request({
//省略ajax請求後台
});
}
}else{
Ext.Msg.alert('提示', '請選擇要刪除的記錄');
}
};
說明:
var filePath = row.get('filePath');
利用row.get('欄位名稱');
可以獲得你想要的欄位值
 
extjs gridpanel載入完後 選中指定行

學習了
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.