TreeGrid default open all

Hi,

Is there a property I can set on a TreeGrid to open all folders by default?

Similar to how groupStartOpen:“all” works for grouped ListGrids?

Thanks,
Mike

You can either call openAll() from the fetchData callback, or set Tree.openProperty and return true for the openProperty in your data for all folders.

Hi,

The following doesn’t work…

I just noticed I need to put my code in the fetchData callback, not the filterData callback.

But since my treeGrid is databound, who do I gain access to the callback of the fetchData?

	inlnTree.filterData(
		{
			inln_inhd_id: myApp.selectedInvoice.id,
			inln_parent_id: 0
		},
		function () {
			// Show all folders open
			inlnTree.openAll();
		}
	);

Thanks,
Mike

Here is how I got TreeGrid to openAll() when its data is returned. I set autoFetchData to false and then I call fetchData with a callback after creating the TreeGrid. Give it a shot.

// an XML data source using XPath
isc.DataSource.create({
    ID: "jeffPOMData",
    dataURL: "http://localhost:8080/shared/ds/JeffStaticData.xml",
    recordXPath: "//category | //position",
    fields: 
	[
	  { name: "id", type:"integer", primaryKey:true, hidden:true }
	 ,{ name: "parentid", type:"integer", foreignKey:"jeffPOMData.id", hidden:true }
     ,{ name: "name" }
     ,{ name: "sec_id" }
     ,{ name: "total_qty" }
     ,{ name: "exposure_percent" }
     ,{ name: "total_amt" }
     ,{ name: "target_weight" }
     ,{ name: "deviation" }
    ]
});

// create the Grid bound to this datasource
var tg = TreeGrid.create({
	ID:"jeffTreeGrid",
	position:"relative", 
	width:"98%", // 100% has no right border.  98% looks great.
	height:200,
	dataSource:"jeffPOMData",
	editByCell:"true",
	editEvent:"click",
	alternateRecordStyles:true,
	animateFolders:true,
	animateFolderSpeed:500,
	autoFitAllText:"Adjust all column widths",
	autoFitFieldWidths:false,
	autoFitData:"vertical",
	autoFetchData:false,
	// loadDataOnDemand: false prevents child nodes in a tree grid from collapse/expand
    loadDataOnDemand: false,
	canAddFormulaFields:true,
	headerHeight:20,
	editByCell:true,
	groupStartOpen:"all",
	fields:[
		{name:"name", width:250, treeField:true },
		{name:"sec_id", formatCellValue:"isc.Format.toUSString(value,2);"},
		{name:"total_qty", formatCellValue:"isc.Format.toUSString(value,2);"},
		{name:"exposure_percent", formatCellValue:"isc.Format.toUSString(value,2);"},
		{name:"total_amt", formatCellValue:"isc.Format.toUSString(value,2);"},
		{name:"target_weight", formatCellValue:"isc.Format.toUSString(value,2);"},
		{name:"deviation", formatCellValue:"isc.Format.toUSString(value,2);"}
	]
});

// This call to fetchData with a callback makes the grid expand all of its nodes once data is returned.
jeffTreeGrid.fetchData(null, 'jeffTreeGrid.data.openAll()');

Cheers,
Jeff

That worked…

Thanks!

You’re welcome!