File

device-grid/device-grid.component.ts

Implements

OnInit OnChanges OnDestroy GridConfigContextProvider

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(deviceGridService: DeviceGridService)
Parameters :
Name Type Optional
deviceGridService DeviceGridService No

Inputs

actionControls
Type : []

Sets action controls (actions available for individual items). If not given, it defaults to standard actions.

baseQuery
Type : any
Default value : {}

Sets the base query which is appended to the request for data.

bulkActionControls
Type : []

Sets bulk action controls (actions available for items selected by user). If not given, it defaults to standard bulk actions.

childDeviceGrid
Type : boolean
Default value : false
columns
Type : Column[]

The list of columns to be displayed in the grid. If not given, it defaults to standard columns.

columnsConfigKey
Type : string

The name of the key where columns configuration will be stored.

dataCallback
Type : DataCallback

Optional callback function that allows to modify server side data result before it's rendered.

headerActionControls
Type : []

Sets header action controls (actions available from the grid header). If not given, it defaults to empty list of actions.

infiniteScroll

Sets load more mode.

legacyConfigKey
Type : string
legacyFilterKey
Type : string
loadingItemsLabel
Type : string
Default value : gettext('Loading devices…')

The label for loading indicator.

loadMoreItemsLabel
Type : any
Default value : gettext('Load more devices')

The label for load more button.

pagination

Pagination settings, e.g. allows for setting current page or page size. If not given, defaults to standard settings.

parentDeviceId
Type : string
refresh
Type : EventEmitter<any>
Default value : new EventEmitter()

Takes an event emitter. When an event is emitted, the grid will be reloaded.

selectable
Type : boolean
Default value : false

Determines whether items can be selected by clicking a checkbox in the first column.

title
Type : string
Default value : gettext('Devices')

The title for the data grid, it's displayed in the grid's header.

withChildren
Type : boolean
Default value : false

Sets the withChildren query which is appended to the request.

Outputs

itemsSelect
Type : EventEmitter

Emits an event when items selection changes. The array contains ids of selected items.

onColumnsChange
Type : EventEmitter<Column[]>

Emits an event when columns configuration changes.

onDeviceQueryStringChange
Type : EventEmitter<string>
onFilterChange
Type : EventEmitter<FilterConfig[]>

Methods

getGridConfigContext
getGridConfigContext()
ngOnChanges
ngOnChanges(changes: SimpleChanges)
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void
ngOnDestroy
ngOnDestroy()
Returns : void
ngOnInit
ngOnInit()
Returns : void
Async onDataSourceModifier
onDataSourceModifier(dataSourceModifier: DataSourceModifier)
Parameters :
Name Type Optional
dataSourceModifier DataSourceModifier No
onDeleteDevice
onDeleteDevice(device)
Parameters :
Name Optional
device No
Returns : void
Async setActionControls
setActionControls()
Returns : any
trackByName
trackByName(_index, column: Column)
Parameters :
Name Type Optional
_index No
column Column No
Returns : string
updateFiltering
updateFiltering(columnNames: string[], action: literal type)
Parameters :
Name Type Optional
columnNames string[] No
action literal type No
Returns : void

Properties

actionControls
Type : ActionControl[]
Default value : []
appliedFilters
Type : FilterConfig[]
Default value : []
bulkActionControls
Type : BulkActionControl[]
Default value : this.deviceGridService.getDefaultBulkActionControls()
columns
Type : Column[]
Default value : this.deviceGridService.getDefaultColumns()
configureColumnsEnabled
Type : boolean
Default value : true
dataGrid
Type : DataGridComponent
Decorators :
@ViewChild(DataGridComponent, {static: true})
Public deviceGridService
Type : DeviceGridService
headerActionControls
Type : HeaderActionControl[]
Default value : this.deviceGridService.getDefaultHeaderActionControls()
infiniteScroll
Type : LoadMoreMode
pagination
Type : Pagination
Default value : this.deviceGridService.getDefaultPagination()
serverSideDataCallback
Type : any

Accessors

_pagination
set_pagination(value: Pagination)

Pagination settings, e.g. allows for setting current page or page size. If not given, defaults to standard settings.

Parameters :
Name Type Optional
value Pagination No
Returns : void
_infiniteScroll
set_infiniteScroll(infiniteScroll: LoadMoreMode)

Sets load more mode.

Parameters :
Name Type Optional
infiniteScroll LoadMoreMode No
Returns : void
_actionControls
set_actionControls(value: ActionControl[])

Sets action controls (actions available for individual items). If not given, it defaults to standard actions.

Parameters :
Name Type Optional
value ActionControl[] No
Returns : void
_bulkActionControls
set_bulkActionControls(value: BulkActionControl[])

Sets bulk action controls (actions available for items selected by user). If not given, it defaults to standard bulk actions.

Parameters :
Name Type Optional
value BulkActionControl[] No
Returns : void
_headerActionControls
set_headerActionControls(value: HeaderActionControl[])

Sets header action controls (actions available from the grid header). If not given, it defaults to empty list of actions.

Parameters :
Name Type Optional
value HeaderActionControl[] No
Returns : void
<c8y-data-grid
  [title]="title"
  [loadMoreItemsLabel]="loadMoreItemsLabel"
  [loadingItemsLabel]="loadingItemsLabel"
  [columns]="columns"
  [pagination]="pagination"
  [infiniteScroll]="infiniteScroll"
  [actionControls]="actionControls"
  [selectable]="selectable"
  [bulkActionControls]="bulkActionControls"
  [serverSideDataCallback]="serverSideDataCallback"
  (itemsSelect)="itemsSelect.emit($event)"
  [refresh]="refresh"
  [headerActionControls]="headerActionControls"
  [configureColumnsEnabled]="configureColumnsEnabled"
>
  <c8y-ui-empty-state
    [icon]="'search'"
    [title]="'No matching devices.' | translate"
    [subtitle]="'Refine your search terms' | translate"
    [horizontal]="true"
  ></c8y-ui-empty-state>

  <ng-container *ngFor="let column of columns; trackBy: trackByName">
    <c8y-column [name]="column.name"></c8y-column>
  </ng-container>
</c8y-data-grid>

results matching ""

    No results matching ""