Artikel: AN0001619Aktualisiert: 11.08.2018
Die vorgegebene Sprachenversion vom Artikeltext wird angezeigt, weil es kein Text von der ausgewählten Sprache und Version gibt.
Buttons are used for a quick adding of functionality to a page with records (list of records or detail of one record) or to a page with web parts.
You can perform a number of operations by means of buttons, e.g. start a workflow, display a page according to input URL, execute a script, display a scheme etc.
Buttons can be placed on toolbar or in the context menu.
Text and icon can be assigned to each button. You can create whatever number of buttons you need. Order of the buttons is determined by the setiing Order.
The buttons will be displayed only if the user has access right for the button and if the user has access rights to the object that is linked to the button, ie. workflow, scheme, class...
Script execution
There are following properties available at button that is executing a script:
Name |
Description |
OGForm |
Object for work with page content. |
int? OGActualDataRowParentId |
Class or query Id. |
int? OGActualDataRowId |
Record Id. This property is null in case of button placed on toolbar in the list of records. |
List OGFilteredDataRowIds |
List of Id of data records displayed on page Datas.aspx. |
List OGSelectedDataRowIds |
List of Id of data records selected on page Datas.aspx. |
JSDataDetailForm OGDataDetailForm |
Object for work with a detailed form. |
Model OGModel |
Model, into which current page or class belongs to. |
JSFilter OGFilter |
Object for work with filters on page Datas.aspx |
JSSelectedIds OGSelectedDataRow |
List of selected records - on master-detail relations, selected by means of checkbox. |
ControlOperation OGControlOperation |
Button, on which the user clicked. |
ContentPage OGContentPage |
Page, for which the button is defined. |
OGDataParent |
Class or query for which the button is defined. |
When the button is placed in page with webparts both properties OGActualDataRowParentId and OGActualDataRowId are null.
Property OGDataDetailForm is available only on page DataDetail.aspx.
Property OGSelectedDataRow is available only on page DataDetail.aspx. It contains list of check records from particular tabs for master-detail relations.
Properties OGContentPage and OGDataParent are filled in according to the context, where the button was clicked. The properties are always defined but they may contain a NULL value.
Property OGFilteredDataRowIds contains list Id of of data records that were displayed the last time for the given class or query. If there is filter applied on the page, then only Id of these filtered records will be contained.
Paging used does not influence this property. Always all Id will be contained, no matter to how many pages data records are split.
Example:
var ids = OGFilteredDataRowIds;
if ( ids != null)
{
OGForm.SetInfo( 'Number of records: ' + ids.Count);
}
else
{
OGForm.SetInfo( 'The list is empty.');
}
Property OGSelectedDataRowIds contains list of Id of data records, that were selected by clicking in the given class or query on page Datas.aspx. Number of records selected in this way is displayed under the list of data (e.g. text Records: 1-20 / 20 (selected: 2)).
Example of going through the list of selected records. Similar example can be used also for filtered records.
var ids = OGSelectedDataRowIds;
if ( ids != null)
{
for( var i = 0; i < ids.Count; ++i)
{
//process one record
OGForm.SetInfo( 'Id: ' + ids[i]);
}
}
else
{
OGForm.SetInfo( 'The list is empty.');
}
Example of deleting selected (marked with mouse) records by a script on a button.var ids = OGSelectedDataRowIds;
if ( ids != null)
{
for( var i = 0; i < ids.Count; ++i)
{
//delete one record
og.datarow.deletedata(ids[i/], OGActualDataRowParentId);
}
}
else
{
OGForm.SetInfo( 'You have not selected any record.');
}
Update of hidden columns
Sometimes it is necessary to update columns that are not displayed in the form. If you perform record save with a button, you can set these columns by means of methods OGDataDetailForm.Save or OGDataDetailForm.SaveTask with parameter dataRowProperty and store them in the database.