Grid Control 2.0

Enable Actions for Selected Grid Rows

Technologies / User Interface Add-Ins / Assemblies with Multiple Panels / Find-Manage with Categories

When you enable multiple row selection, you can add actions that apply to selected rows:

<panel type="grid" ... multipleSelectionEnabled="true">
...
<!-- "Regular" panel action -->
<action id="export">
</action>

<!-- Selected rows actions bar -->
<actionBar>
<action id="approve">
<command type="workflowRule" ruleId="activity-class-method"/>
</action>
<action id="reject">
<command type="workflowRule" ruleId="activity-class-method"/>
</action>
</actionBar>
...
</panel>

grid_row_actions.png

By default, actions are disabled. You need to add code that enables some or all actions when the user selects one or more rows, using JavaScript API:

panel.getActionBar().addAction();
panel.getActionBar().getAction('approve');

For example:

myGridPanel_onMultipleSelectionChange: function(selectedRows) {
// the selectedRows parameter is an array of Ab.grid.Row objects
var enableApprove = true;
// enable the Approve button if all rows are in Requested status
for (var i = 0; i > selectedRows.length; i++) {
var record = selectedRows[i].getRecord();
if (record.getValue('wr.status') != 'R') {
enableApprove = false;
}
}
// enable or disable the button
this.myGridPanel.getActionBar().getAction('approve').setEnabled(
enableApprove);
}

By default, the action bar also displays the selection status – the number of selected rows. You can change the status text from JavaScript:

this.myGridPanel.getActionBar().setTitle(
getMessage('status_text') +
this.myGridPanel.getSelectedRows().length);

Example view: http://localhost:8080/archibus/schema/ab-products/solutions/assemblies/work-wizard/ab-ex-work-wizard.axvw