An example of the default expansion problem for the RowExpander control in Extjs

  • 2020-03-30 01:29:00
  • OfStack

 
//Expand a row that meets a condition
function expendRow() 
{ 
var i;//Cyclic temporary variable
var arr = [];//Array of rows to expand
for(i=0;i<ProdRequireInfoStore.data.length;i++)//ProdRequireInfoStore is the data source of the gridpanel
{ 
var record = ProdRequireInfoStore.getAt(i);//Loop through each row

if(record.data.StatusID=='3'){//If it fits my criteria, I'll write it into the array
arr.push(i); 
} 
} 
for(var j =0;j<arr.length;j++){//Traversal group expansion calls the toggleRow(index) method to expand a row
expander.toggleRow(arr[j]); 
} 


} 

//Calls the callback function to expand the default line when the data source is loaded

ProdRequireInfoStore.load({ 
params: { 
dir: 'DESC', 
start: 0, 
limit: 20, 
KeyWord: '' 

}, 
callback:expendRow //The callback function expands the default line
}); 

So that when you open the gridpanel you can implement the default expansion of the RowExpander

Related articles: