Grid views are web components for
listing information in the tabular fashion. At the grid view's top, there
is a menu / button bar; several standard elements have
been implemented for this function bar: Create New button, Export
record to Excel button, and Delete menu item. By default, clicking on any
record row in the grid view will launch a base form to allow end user to
edit this row record. Under the function bar is the grid view's header section; clicking on
each header the grid view will sort its dataset by this column in ascending or
descending order.
Where to Host Grid Views
Once you
build a grid view, you may host it in one of the following six web forms:
- Base Forms
- Navigation Forms
- List Forms
- Tab Forms
- Search Forms
- Multiple-Value Pickers
Grid View Attributes
- View Name: Name of the grid view;
- View ID: Grid view's internal id;
- Gridview Type: Gridview type is based on where
to use this grid view; for special grid views, the parameter sets are
pre-defined;
- Can Select: Indicate if a checkbox is needed at the beginning
of each record row; To use delete record function or support bulk update functions,
this field must set to Yes;
- Can Preview: Indicate if
data preview function is enabled; the preview fields are configured in the associated
base form (see Preview Field attribute
of base form field);
- Can Sort: Indicate if the sort function is
enabled when user clicks the column headers;
- Show Icon: Indicate if the object icon will be
shown at the beginning of each data row; if this field sets to Yes,
the following image file must exist:
/lgwres/imgs/objicons/obj_xxx.gif
(here xxx is the View Object ID)
- Pass Login: Indicate if the login user id is
passed to the SQL statement (through named parameter: @userId);
- First Column: Indicate what data is in the first column of the dataset.
If it sets to Record ID, system will pass first column data
to the base form when user clicks any row in the grid view;
or to the stored procedure lwspDeleteObject if user selects
rows then clicks Delete (under Action menu);
or to the stored procedure lwspBulkUpdate if user selects
rows then clicks any bulk update functions
(for example: base form and grid view check out / check in functions);
while if the first column sets to UI Control String, then the data
of the first column will be used to control the data presentation of each
row, and the second column will be used as Record ID as aforementioned.
UI Control String keywords:
trclass: the CSS class name for the entire data row;
checkbox: attributes for the checkbox, for example: disabled, checked;
See stored procedure lwspUserPermissionView for code example:
SELECT case when a.code_id is null then 'checkbox:disabled'
when a.code_id=1 then 'checkbox:disabled checked;trclass:perm_g'
when a.code_id=2 then 'checkbox:disabled checked;trclass:perm_y'
when a.code_id=3 then 'checkbox:disabled;trclass:perm_n' end as ui,
p.id,p.perm_id,dbo.lwfnPermHtmlName(p.name,l.glevel) as name,
case when a.code_id is null OR a.code_id in (4,5) then 'no access'
else 'has access' end as access_level
FROM lgwPermKeys p INNER JOIN dbo.lwfnSortedPermKeyList() l ON (p.id=l.id)
...
- View Object: The user object which the data
listed in the grid view belongs to;
- Default Sort: The initial sort by column(s);
- SQL Type: The type of the SQL statement: Select
Statement or Stored Procedure;
- SQL Statement: The SQL will be used to fill the
grid view's dataset;
- View Access: View access permission key;
- Record Base Form: Base form to create new or edit existing record for
this grid view, or precisely for this grid view's View Object (the base form's user
object must be the same as the grid view's view object);
- Create Record: Indicate if the Create New button will be on the grid view's
Right Side Menu;
- Edit Script: JavaScript function to handle the record row clicked event.
There are three system pre-defined functions:
{OpenEditBaseForm}:
Open base form for editing; only one window can remain open;
{OpenEditBaseFormEx}:
Open base form for editing; multiple windows can remain open;
oTR.cells[0].firstChild.click():
Same effect as clicking on the checkbox in the row;
If you want to implement your own JavaScript function for the Edit Script,
you may use the following conventions to access grid view's internal data:
{gridId}: Grid view web control ID;
{objId}: Grid view User Object ID;
{viewId}: Grid view internal ID;
{recId}: Data record ID for Gridview hosted by base form;
- Delete Record: Indicate if the Delete button will be on the grid view's
Action Menu;
- JavaScript: custom JavaScript functions; click SQL & JS button to find out what
JavaScript function(s) you should implement;
- Style Sheet: If any CSS class is used in UI Control String (trclass),
you should define the CSS class in this field;
Toolbar Buttons
- SQL & JS: Hints on how to generate SQL Statement
and list all custom JavaScript function names;
Children Attributes
- Headers: List of the grid view's headers. If you have generated the
SQL statement, you may click on Auto Headers button to generate the header list
based on the SQL Statement;
- Parameters: List of the grid view's parameters.
System automatically generates parameters for all special grid views.
- Menu Bars: List of the grid view's menu items and buttons.
Functions for Create New and Delete can not
be altered, but you can add your own menu item or button by
clicking New Gridview Menu button.
|