Initialize and Load Data
Grid Control 3.0
Initialize and Load Data
Use these controls to load data in grids:
Initial Data Fetch
By default, when the application creates an instance of the grid control, the control immediately loads and displays data from the data source specified in the control configuration. The control loads only the first page of data, based on the
pageSize
configuration parameter:
var grid = View.createControl({ control: 'DataGrid', dataSource: 'projectsDataSource', pageSize: 100, ... other configuration options ... });
If you do not want the control to load and display the default data set, add the
showOnLoad=false
configuration parameter:
var grid = View.createControl({ control: 'DataGrid', dataSource: 'projectsDataSource', pageSize: 100, showOnLoad: false, ... other configuration options ... });
Refresh Data
To load up-to-date records from the server, and display them in a grid, use the
grid.refresh
method:
grid.refresh(restriction);
To specify an optional restriction for records:
var restriction = new Ab.view.Restriction(); restriction.addClause('wr.status', 'A'); grid.refresh(restriction);
Grid control does not process the restriction parameter, but passes the restriction to
DataSource.getGroups
and
DataSource.getDataSet
methods.
You can also specify named parameters used in the data query:
grid.addParameter('requireWorkOrder', true); grid.refresh();
To pass parameter values to the data source, grid control calls the
DataSource.addParameter
method.