Skip to main content
Version: 8.0

GridUtilitiesV2 mixin

Level: advanced

GridUtilitiesV2 is a mixin that provides the management logic for the "List" control. Implemented in the Terrasoft.configuration.mixins.GridUtilities class of the NUI package. Learn more about the "List" control in the user documentation: Work with record lists.

The mixin lets you:

  • Subscribe to messages.

  • Load data.

  • Manage the list:

    • Select records (search for active records).
    • Add, delete, edit records.
    • Set the filters.
    • Sort the records.
    • Export records to a file.
    • Check the access permissions to the list records.

Methods

init()

Subscribes to events.

destroy()

Clears event subscriptions.

loadGridData()

Loads the list data.

beforeLoadGridData()

Prepares the view model before the data is loaded.

afterLoadGridData()

Prepares the view model after the data is loaded.

onGridDataLoaded(response)

Handles data load events. Executed when the server returns data.

Parameters

response

The result of database data selection.

addItemsToGridData(dataCollection, options)

Adds the collection of new elements to the collection of the list.

Parameters

dataCollection

The collection of new elements.

options

Addition parameters.

initQueryOptions(esq)

Initializes the query instance settings (pagination, hierarchy).

Parameters

{Terrasoft.data.queries.EntitySchemaQuery} esq

The query in which to initialize the relevant settings.

initQuerySorting(esq)

Initializes the sorting columns.

Parameters

{Terrasoft.data.queries.EntitySchemaQuery} esq

The query in which to initialize the relevant settings.

prepareResponseCollection(collection)

Modifies the data collection before loading it to the list.

Parameters

collection

Collection of list elements.

getFilters()

Returns the filters applied to the schema. Overload the method in the inheritors.

exportToFile()

Exports the list contents to a file.

sortGrid(tag)

Sorts the list.

Parameters

{String} tag

Specifies how to sort the list.

deleteRecords()

Initiates deletion of the selected records.

checkCanDelete(items, callback, scope)

Checks whether the record can be deleted.

Parameters

items

IDs of selected records.

callback

The callback function.

scope

The method execution context.

onDeleteAccept()

Deletes the record after the user confirms the deletion.

getSelectedItems()

Returns the selected list records.

removeGridRecords(records)

Removes the deleted records from the list.

Parameters

records

The deleted records.

reloadGridData()

Reloads the list.