//一. 獲得 GridPanel 的 SM
var sm = Ext.getCmp("book_grid").getSelectionModel();
var select = sm.getSelected();// 返回首個選擇的記錄.
//二. 判斷有沒有記錄被選中.
//(1)有記錄選中則返回真.
// if ( sm.hasSelection ( ) )
// (2)沒有記錄選中時 select 為null, 則返回假.
if (select)
select = select.data; //select.data 返回一個JSON對象數(shù)組. select.data.屬性.
else { // 沒選擇數(shù)據(jù),即退出函數(shù).
Ext.MessageBox.alert("錯誤", "請先選擇一行數(shù)據(jù)!");
};