複製代碼代碼如下:
//展開符合某個條件的行
function expendRow()
{
var i;//循環臨時變量
var arr = [];//要展開的行的數組
for(i=0;i<ProdRequireInfoStore.data.length;i++)//ProdRequireInfoStore是gridpanel的數據源
{
var record = ProdRequireInfoStore.getAt(i);//循環遍歷每一行
if(record.data.StatusID=='3'){//符合我的條件則寫入數組中
arr.push(i);
}
}
for(var j =0;j<arr.length;j++){//遍歷數組展開調用toggleRow(index)方法展開某一行
expander.toggleRow(arr[j]);
}
}
// 調用當數據源加載完成的時候調用回調函數展開默認行
ProdRequireInfoStore.load({
params: {
dir: 'DESC',
start: 0,
limit: 20,
KeyWord: ''
},
callback:expendRow //回調函數展開默認行
});
這樣當你打開gridpanel的時候就能實現,RowExpander的默認展開