12.07.2015 Views

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

GridTypically a OnCreateDataSet callback method looks like this:Method CreateDS(pGrid As %ZEN.Component.dynaGrid,pDataSet As %ZEN.Auxiliary.dataSet) As %Status{// make sure dataSet is cleared outDo pDataSet.%Clear()// fill in contents of dataSet// This is a 2-D data structure// row labels (dimension 1)Do pDataSet.%SetLabel("Boston",1,1)Do pDataSet.%SetLabel("New York",2,1)Do pDataSet.%SetLabel("Chicago",3,1)Do pDataSet.%SetLabel("Miami",4,1)// column labels (dimension 2)Do pDataSet.%SetLabel("Cars",1,2)Do pDataSet.%SetLabel("Trucks",2,2)Do pDataSet.%SetLabel("Trains",3,2)Do pDataSet.%SetLabel("Planes",4,2)// get size of dataSetSet rows = pDataSet.%GetDimSize(1)Set cols = pDataSet.%GetDimSize(2)// fill in initial data valuesFor r=1:1:rows {For c=1:1:cols {Set value = 0Do pDataSet.%SetValue(value,r,c)}}}Quit $$$OKThe above example defines a two–dimensional dataSet object with four rows and four columns. It supplies labels for therows and columns and then loops over the cells to provide initial values for the cells.If the OnCreateDataSet callback changes the dataSet object to contain three dimensions, this gives the theability to move among “pages” of data. Each page is displayed as a two-dimensional grid that represents the currently visiblepage. The following figure illustrates this data model. For details regarding the label attributes shown in the figure, seethe , , and “ Attributes” sections in this chapter.<strong>Using</strong> <strong>Zen</strong> <strong>Components</strong> 141

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!