Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
import {Column, dates, Form, FormModel, GroupBox, HtmlTile, icons, InitModelOf, MessageBoxes, models, numbers, scout, StaticLookupCall, TabItem, TableAppLinkActionEvent, TableRowModel} from '@eclipse-scout/core';
import {arrays, Column, dates, Form, FormModel, GroupBox, HtmlTile, icons, InitModelOf, MessageBoxes, models, numbers, scout, StaticLookupCall, TabItem, TableAppLinkActionEvent, TableRowModel} from '@eclipse-scout/core';
import {BooleanColumnPropertiesBox, ColumnLookupCall, DateColumnPropertiesBox, LocaleLookupCall, LookupCallColumnPropertiesBox, LookupColumnPropertiesBox, NumberColumnPropertiesBox, TableFieldTable, TableFormWidgetMap} from '../index';
import TableFormModel from './TableFormModel';

Expand Down Expand Up @@ -37,6 +37,7 @@ export class TableForm extends Form {

this.table = this.widget('Table');
this.widget('AddRowMenu').on('action', this._onAddRowMenuAction.bind(this));
this.widget('SelectLastRowMenu').on('action', this._onSelectLastRowAction.bind(this));
this.widget('MoveToTopMenu').on('action', this._onMoveToTopMenuAction.bind(this));
this.widget('MoveUpMenu').on('action', this._onMoveUpMenuAction.bind(this));
this.widget('MoveDownMenu').on('action', this._onMoveDownMenuAction.bind(this));
Expand Down Expand Up @@ -193,6 +194,13 @@ export class TableForm extends Form {
this.table.insertRow(this._createRow());
}

protected _onSelectLastRowAction() {
if (arrays.hasElements(this.table.rows)) {
let lastRow = arrays.last(this.table.rows);
this.table.selectRow(lastRow);
}
}

protected _onMoveToTopMenuAction() {
this.table.moveRowToTop(this.table.selectedRows[0]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ export default (): FormModel => ({
text: '${textKey:AddRow}',
keyStroke: 'insert'
},
{
id: 'SelectLastRowMenu',
objectType: Menu,
text: '${textKey:SelectLastRow}'
},
{
id: 'MoveMenu',
objectType: Menu,
Expand Down Expand Up @@ -309,6 +314,7 @@ export class TableFieldTable extends Table {
export type TableFieldTableWidgetMap = {
'AggregateTableControl': AggregateTableControl;
'AddRowMenu': Menu;
'SelectLastRowMenu': Menu;
'MoveMenu': Menu;
'MoveToTopMenu': Menu;
'MoveUpMenu': Menu;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ ResetMenuTooltip=Resets the form to its initial state.
RevealTooltip=Brings the widget into view by scrolling the first scrollable parent. The action does not have any effect if the widget is already fully visible or there is no scrollbar. \r\n\r\nIn order to test it make the window smaller so that the scrollbar appears, then scroll the widget out of view and press the button.
Salutation=Salutation
SaveMenuTooltip=Saves the changes without closing the form.
SelectLastRow=Select last row
Settings=Settings
SmartField=Smart Field
SpellCheckEnabledTooltip=This flag requires the spell checker of the browser to be enabled (check browser settings).\r\n\r\nAlso, depending on your browser, changing the flag dynamically may not have an immediate effect. Try to adjust the text, leave the field (focus out) or rerender the field (navigate to another widget and come back) to force the browser to reapply the setting.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,25 @@ protected Set<? extends IMenuType> getConfiguredMenuTypes() {
}
}

@Order(17)
@ClassId("31d37347-2c4a-46f6-bec1-7f9de9b24478")
public class SelectLastRowMenu extends AbstractMenu {
@Override
protected String getConfiguredText() {
return TEXTS.get("SelectLastRow");
}

@Override
protected void execAction() {
selectLastRow();
}

@Override
protected Set<? extends IMenuType> getConfiguredMenuTypes() {
return CollectionUtility.<IMenuType> hashSet(TableMenuType.EmptySpace);
}
}

@Order(20)
@ClassId("09b54c41-321e-404c-aba9-543db48d2fd0")
public class ToggleGroupingStyle extends AbstractMenu {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ SearchRequired=Search Required
Section=Section
Select=Select
SelectAll=Select all
SelectLastRow=Select last row
SelectLocale=Select the locale used for formatting
SelectNone=Select none
SelectTab=Select tab
Expand Down