extjs gridpanel 操作行 得到選中行

來源:互聯網
上載者:User

標籤:toolbar   padding   indent   指定   color   擷取   middle   cin   tar   

extjs gridpanel 操作行 得到選中行的列 
在Extjs 3.2.0上適合
var model = grid.getSelectionModel();  model.selectAll();//選中所有行  model.selectFirstRow();//選中第一行  model.selectLastRow([flag]);//選中最後一行,flag為正的話保持當前已經選中的行數,不填則預設false  model.selectNext();//選中下一行  model.selectPrevious();//選中上一行  model.selectRange(startRow,endRow, [Boolean keepExisting] );//選中範圍間的行  model.selectRow(row);//選中某一行,,,從0開始  model.selectRows(rows);//選中指定一些行,傳遞數組如[1,3,5],則分別選擇1,3,5行  model.clearSelections();//清空所有選中  model.deselectRange( startRow, endRow );//取消從startrow到endrow的記錄的選擇中態  model.deselectRow(row);//取消指定行的記錄grid.getSelected().id //得到選中的行的標識

得到選中的行。
書上的P62頁:
 var sm=grid.getSelectionModel();
var record=sm.getSelections()[0];這個代表選擇的一行,書上少了一個s。
var record=sm.getSelections()表示選中的很多行,得到的是一個數組。
精確到具體某一列的資料,, record.get("列名")。
適合Extjs 3.2
var sm=grid.getSelectionModel();
var record=sm.getSelected();
record只是一行資料。如果選擇多好資料則這個不行了。
Extjs中EditorGridPanel擷取某一儲存格內的控制項的相關資訊   1. 擷取列號為colIndex行號為rowIndex的儲存格內的控制項的方法為:var compo= grid.getColumnModel().getCellEditor(colIndex, rowIndex);2. 擷取該儲存格內的控制項的值的方法為:var value = compo.getValue();3. 假設compo為combobox控制項,則擷取控制項的資料來源的方法為:var compoStore = compo.field.getStore();4. 在3的基礎上擷取選中的combobox的Index的方法:var index = compoStore .find(‘列名‘,value);  轉自:http://blog.csdn.net/mastershaw/article/details/51385042

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.