SMART datagrid v.1 > Examples

Back  Forward

Shared Grid RowSource  Example

SMART datagrid is separated in three layers such as data set, row model and grid view, and loosely connected through internal events. Especially, the grid is indirectly connected to the data set through the row model. And, the row model configures not only the data rows of the data set but also the other rows that make up the grid and displays them in the grid. 

The row model is respectively configured by GridRowSource and TreeRowSource depending on the grid and tree and approached through GridBase.rowSource property. Basic rowSource will be created when create the grid, but you can reallocate with a newly created object from outside through this property. And importantly, several grids can share one rowSource object. 

Grid - 1
rows
Grid - 2
rows

Grid-2 sets rowSource of Grid-1 as its rowSource

Code -1
    grdMain2.setRowSource(grdMain.rowSource());

The row model is an object in which can apply sorting, filtering, grouping and paging, and has the current row location information. In other words, the same sorting and filtering will be reflected in the grids which share rowSource and the focus will be displayed in the same row location. However, each grid can have individual column model, and the focused column can be different. 

Therefore, the focused row of Grid-2 will be changed together when the focused row of Grid-1 is changed. Vice versa. However, the focused column of two grids can be set in different location. You can check it with mouse or keyboard scroll, etc. 

And, since Row Updating, Inserting, Appending will be done in the row model level, the editing started in a grid will be immediately reflected in other grids. You can use Insert key to start Row Updating in one grid or can apply "Quantity" column filter of Grid-2

(As described, since sorting, filtering, grouping and paging are applied in the row model rather than the grid, each execution UI should be enabled in one grid.) 

View Source JSP 

See Also
GridDataSet
GridView
Examples
Shared Data Set