Table of Contents

Class ViewModel<TUIView>

Namespace
GroupeIsa.Neos.Designer.UIAbstractions
Assembly
GroupeIsa.Neos.Designer.UIAbstractions.dll

Represents the MVVM view model of an UI view.

public abstract class ViewModel<TUIView> : BaseComponentViewModel, IViewModel<TUIView>, IViewModel, IBaseViewModel where TUIView : class, IUIView

Type Parameters

TUIView

The type of UI view on which the view model is based.

Inheritance
ViewModel<TUIView>
Implements
IViewModel<TUIView>
Derived
Inherited Members

Properties

Actions

Gets the actions.

public IViewModelActions Actions { get; }

Property Value

IViewModelActions

AddingUIViewName

Gets or sets the name of the UI view that opens to add a new item.

public string? AddingUIViewName { get; set; }

Property Value

string

CanMoveNextPage

Gets a value indicating whether navigating to the next page is possible.

public bool CanMoveNextPage { get; }

Property Value

bool

CanMovePreviousPage

Gets a value indicating whether navigating to the previous page is possible.

public bool CanMovePreviousPage { get; }

Property Value

bool

CreatedItems

Gets the new items of the datasource.

public IReadOnlyCollection<TUIView> CreatedItems { get; }

Property Value

IReadOnlyCollection<TUIView>

CreationAllowed

Gets or sets a value indicating whether creating a new item is allowed.

public bool CreationAllowed { get; set; }

Property Value

bool

CreationMode

Gets or sets a value indicating whether the view is in creation mode.

In creation mode, add item, clone item and refresh actions are disabled.

public bool CreationMode { get; set; }

Property Value

bool

DataSorts

Gets the collection of the sorts set on the datasource.

public IReadOnlyCollection<Sort> DataSorts { get; }

Property Value

IReadOnlyCollection<Sort>

Datafilter

Gets the current data filter applied to the datasource.

public virtual Filter Datafilter { get; }

Property Value

Filter

Datasource

Gets the datasource.

public IDatasource<TUIView> Datasource { get; }

Property Value

IDatasource<TUIView>

DatasourceCurrent

Gets the item at the Position in the datasource.

Null when Position is -1 or greater than the position of the last item of the datasource.

Warning : not to be confused with the Item property of actions / event rules which designates the datasource item on which an action / event rule is triggered. In most cases, you should use the Item property when available instead of DatasourceCurrent.

public TUIView? DatasourceCurrent { get; }

Property Value

TUIView

Examples

The following example shows the access to the instance at the current position.

If the position is valid, the OrderedAt property of the instance is set to the current date.

if (DatasourceCurrent != null)
{
    DatasourceCurrent.OrderedAt = DateTime.Now;
}

Description

Gets the description.

[Obsolete("Use the Title property instead.")]
public string Description { get; }

Property Value

string

EditingLinkPropertyName

Gets or sets the name of the property on which a link for editing the item is displayed.

public string? EditingLinkPropertyName { get; set; }

Property Value

string

EditingUIViewName

Gets or sets the name of the UI view that opens to edit an item.

public string? EditingUIViewName { get; set; }

Property Value

string

EntityName

Gets the name of the entity.

public string? EntityName { get; }

Property Value

string

EntityViewName

Gets the name of the entity view.

public string? EntityViewName { get; }

Property Value

string

GroupDescriptions

Gets the description of the groups made when grouping by a property.

public List<string> GroupDescriptions { get; }

Property Value

List<string>

HasChanges

Gets a value indicating whether the datasource has changes.

Modified items include both new and modified items. Relations and embedded collections (addition / deletion) are also taken into account recursively.

public bool HasChanges { get; }

Property Value

bool

HasErrors

Gets a value indicating whether the datasource has errors.

Relations are also taken into account recursively.

public bool HasErrors { get; }

Property Value

bool

HasMoreData

Gets a value indicating whether more data can be retrieved.

public bool HasMoreData { get; }

Property Value

bool

Icon

Gets the icon.

public string Icon { get; }

Property Value

string

InitSelectionOnLoad

Gets or sets a value indicating whether the selection must be initialized on load.

public bool InitSelectionOnLoad { get; set; }

Property Value

bool

IsMain

Gets a value indicating whether the view model is the main view model.

public bool IsMain { get; }

Property Value

bool

Loading

Gets a value indicating whether data is being loaded.

public bool Loading { get; }

Property Value

bool

ModifiedItems

Gets the modified items of the datasource.

public IReadOnlyCollection<TUIView> ModifiedItems { get; }

Property Value

IReadOnlyCollection<TUIView>

MonoRecord

Gets or sets a value indicating whether the UI view is in mono-record mode.

public bool MonoRecord { get; set; }

Property Value

bool

PageNumber

Gets or sets the number of the current page in the paginated data source.

public int PageNumber { get; set; }

Property Value

int

PersistenceErrorItems

Gets the elements with at least one persistence error.

public IReadOnlyCollection<TUIView> PersistenceErrorItems { get; }

Property Value

IReadOnlyCollection<TUIView>

Position

Gets or sets the current position in the datasource.

public int Position { get; set; }

Property Value

int

Examples

The following example shows how to set the position to the last element.

Position = Datasource.Count - 1;

RecordsByPage

Gets or sets the maximum number of records retrieved by page.

public int RecordsByPage { get; set; }

Property Value

int

Relations

Gets the relationships between the view model and the view models of the sub-views.

[Obsolete("Use Relationships instead.")]
public IReadOnlyCollection<IViewModelRelation> Relations { get; }

Property Value

IReadOnlyCollection<IViewModelRelation>

Relationships

Gets the relationships between the view model and the view models of the sub-views.

public IReadOnlyCollection<IViewModelRelation> Relationships { get; }

Property Value

IReadOnlyCollection<IViewModelRelation>

SelectedItems

Gets the selected items in the datasource.

public IReadOnlyCollection<TUIView> SelectedItems { get; }

Property Value

IReadOnlyCollection<TUIView>

Title

Gets the title.

public string Title { get; }

Property Value

string

TotalRecordCount

Gets the total record count.

public int TotalRecordCount { get; }

Property Value

int

UIViewName

Gets the name of the UI view.

public string UIViewName { get; }

Property Value

string

UrlContext

Gets the URL context which contains additional parameters added to the URL.

public IUrlContext UrlContext { get; }

Property Value

IUrlContext

ValidateLocalizableString

Gets or sets a value indicating whether the localizable strings with a missing translation generate an error / warning.

public bool ValidateLocalizableString { get; set; }

Property Value

bool

ViewContext

Gets the view context which contains values shared between the UI view and its sub-views. Updates to the view context are applied on the UI view and all its sub-views.

When opening another UI view from the current UI view, the values of the current UI view are copied in the opened UI view. Updates to the current view context are not applied to opened UI view. Updates to the opened UI view are not applied to the current UI view.

public IViewContext ViewContext { get; }

Property Value

IViewContext

ViewModelId

Gets the view model identifier defined in the UI view template using the "id" attribute.

public string? ViewModelId { get; }

Property Value

string

Methods

AcceptChanges()

Accepts all the changes made to the datasource since data was loaded or the last time the AcceptChanges() or RejectChanges() was called.

public void AcceptChanges()

AddAsync(IEnumerable<TUIView>, bool)

Adds the specified items at the end of the datasource.

public Task<bool> AddAsync(IEnumerable<TUIView> items, bool asNewItem = false)

Parameters

items IEnumerable<TUIView>

Items to add.

asNewItem bool

A value indicating whether added items should be considered new items.

Returns

Task<bool>

A Task representing the asynchronous operation. The task result contains true if items have been added, false otherwise.

AddAsync(params TUIView[])

Adds the specified items at the end of the datasource.

public Task<bool> AddAsync(params TUIView[] items)

Parameters

items TUIView[]

Items to add.

Returns

Task<bool>

A Task representing the asynchronous operation. The task result contains true if items have been added, false otherwise.

Examples

The following example shows how to add an item to the data source.

Order item = new Order();
if (await AddAsync(item))
{
    Console.WriteLine("Item added");
}
else
{
    Console.WriteLine("Item not added");
}

AddNewAsync()

Creates a new item and adds it at the end of the datasource.

public Task<TUIView?> AddNewAsync()

Returns

Task<TUIView>

A Task representing the asynchronous operation. The task result contains the new item or null if adding has been canceled.

Examples

The following example shows how to create and add a new item to the data source.

IOrder? item = await AddNewAsync();

ClearSort()

Clears the sorts set on the datasource.

public virtual void ClearSort()

CloneAsync(TUIView)

Creates a new item that is a copy of the specified source item and adds it at the end of the datasource.

public Task<TUIView?> CloneAsync(TUIView source)

Parameters

source TUIView

The source item from which the new item will be cloned.

Returns

Task<TUIView>

A Task representing the asynchronous operation. The task result contains the new item that is the result of the cloning operation or null if cloning has been canceled.

CloseAsync(bool, NavigationResult?)

Closes the current view.

public virtual Task CloseAsync(bool displayUnsavedChangesMessage = true, NavigationResult? result = null)

Parameters

displayUnsavedChangesMessage bool

A value indicating whether the unsaved changes message is displayed.

result NavigationResult

The navigation result.

Returns

Task

A Task representing the asynchronous operation.

CreateNewItem()

Creates a new item.

public TUIView CreateNewItem()

Returns

TUIView

The created item.

Remarks

The item is not added to the datasource.

CreateServerDataExportOptions(string, ExportFormat)

Creates the server data export options from the current context.

public virtual ServerDataExportOptions CreateServerDataExportOptions(string fileName, ExportFormat format)

Parameters

fileName string

The file name.

format ExportFormat

The format.

Returns

ServerDataExportOptions

The server data export options.

DeleteDataAsync(IEnumerable<TUIView>)

Removes the specified items from the server via an API call.

public virtual Task<bool> DeleteDataAsync(IEnumerable<TUIView> items)

Parameters

items IEnumerable<TUIView>

Items to remove.

Returns

Task<bool>

A Task representing the asynchronous operation. The task result contains a value indicating whether the items have been removed.

DeleteDataAsync(params TUIView[])

Removes the specified items from the server via an API call.

public virtual Task<bool> DeleteDataAsync(params TUIView[] items)

Parameters

items TUIView[]

Items to remove.

Returns

Task<bool>

A Task representing the asynchronous operation. The task result contains a value indicating whether the items have been removed.

DeleteSelectedItemsAsync()

Deletes the selected items.

public virtual Task<bool> DeleteSelectedItemsAsync()

Returns

Task<bool>

A Task representing the asynchronous operation. The task result contains a value indicating whether the items have been removed.

DisplayWaitingOverlayMessage(string)

Displays a waiting overlay message.

protected virtual void DisplayWaitingOverlayMessage(string message)

Parameters

message string

The message displayed in the overlay.

ExecuteRemoveActionAsync()

Executes the Remove action.

public virtual Task ExecuteRemoveActionAsync()

Returns

Task

A Task representing the asynchronous operation. The task result contains a value indicating whether the items have been removed.

ExecuteReportAsync(string, Filter?, Dictionary<string, object>?)

Executes a report.

public virtual Task ExecuteReportAsync(string reportName, Filter? filter = null, Dictionary<string, object>? parameters = null)

Parameters

reportName string

Report name.

filter Filter

Filter to apply to the data.

parameters Dictionary<string, object>

Parameters to pass to the report.

Returns

Task

A Task representing the asynchronous operation.

ExecuteReportWithOptionsAsync(ExecuteReportOptions)

Executes a report.

public virtual Task ExecuteReportWithOptionsAsync(ExecuteReportOptions options)

Parameters

options ExecuteReportOptions

Options.

Returns

Task

A Task representing the asynchronous operation.

FindSort(string)

Finds the sort set on the specified property.

public virtual Sort? FindSort(string propertyName)

Parameters

propertyName string

The property name.

Returns

Sort

The sort found set on the specified property; otherwise null.

FindSortIndex(string)

Find the index of the sort set on the specified property within DataSorts.

public virtual int FindSortIndex(string propertyName)

Parameters

propertyName string

The property name.

Returns

int

The index of the sort set on the specified property; otherwise -1.

FindSubViewModel<T>(string)

Gets the view model of the sub-view associated to the specified relation property.

public virtual ViewModel<T>? FindSubViewModel<T>(string relationPropertyName) where T : class, IUIView

Parameters

relationPropertyName string

The relation property name.

Returns

ViewModel<T>

The view model of the sub-view or null if it does not exist.

Type Parameters

T

Type of the sub-view managed by the sub-view view model.

Remarks

The search based on the relation property name is not case sensitive.

FindViewModelById<T>(string)

Finds a view model by identifier.

public virtual ViewModel<T>? FindViewModelById<T>(string id) where T : class, IUIView

Parameters

id string

The identifier.

Returns

ViewModel<T>

The view model or null if it does not exist.

Type Parameters

T

Type of UI view managed by the view model.

FindViewModelOfViewContainer<TContainerUIView>(string)

Finds the view model of a view container in the current UI view corresponding to the specified container identifier.

public virtual ViewModel<TContainerUIView>? FindViewModelOfViewContainer<TContainerUIView>(string containerId) where TContainerUIView : class, IUIView

Parameters

containerId string

The container identifier.

Returns

ViewModel<TContainerUIView>

The view model of the found view container or null when the view container was not found.

Type Parameters

TContainerUIView

The type of the UI view loaded in the view container.

GetAction(string)

Gets the view model of the specified action.

public virtual IViewModelAction GetAction(string name)

Parameters

name string

The action name.

Returns

IViewModelAction

The view model of the action.

Exceptions

Exception

The action does not exist.

GetCloningAllowed(TUIView)

Gets a value indicating whether cloning an item is allowed.

public bool GetCloningAllowed(TUIView item)

Parameters

item TUIView

Item on which the CloningAllowed value must be checked.

Returns

bool

true if the item can be cloned; otherwise, false.

GetDeletionAllowed(TUIView)

Gets a value indicating whether deleting an item is allowed.

public bool GetDeletionAllowed(TUIView item)

Parameters

item TUIView

Item on which the DeletionAllowed value must be checked.

Returns

bool

true if the item can be deleted; otherwise, false.

GetDisplayableProperties()

Gets the displayable properties.

public IReadOnlyCollection<IViewModelProperty> GetDisplayableProperties()

Returns

IReadOnlyCollection<IViewModelProperty>

The displayable properties.

GetFilterableProperties()

Gets the filterable properties.

public IReadOnlyCollection<IViewModelProperty> GetFilterableProperties()

Returns

IReadOnlyCollection<IViewModelProperty>

The properties.

GetFullDatasource()

Gets the original datasource when the UI view datasource comes from a computed source.

When a parent UI view displays in its template the current UI view, it can provide a computed source. This source can contain different items from the ones that should originally be included in the datasource. This is typically used to provide a filtered datasource to a sub-view.

GetFullDatasource() gets the original datasource instead on the one from the computed source.

public IDatasource<TUIView> GetFullDatasource()

Returns

IDatasource<TUIView>

The original datasource.

Remarks

If the datasource does not come from a computed source, GetFullDatasource() return the same value as Datasource.

GetOwnerFrame()

Gets the owner frame of this UI view.

public IFrame? GetOwnerFrame()

Returns

IFrame

The owner frame or null if this UI view does not belong to a frame.

GetParentItem<TParentUIView>()

Gets the parent item that this data source is in relation with.

public TParentUIView? GetParentItem<TParentUIView>() where TParentUIView : class, IUIView

Returns

TParentUIView

Parent item or null when this data source does not belong to a relationship.

Type Parameters

TParentUIView

Type of the parent item.

Examples

The following example shows how to affect a 10% discount when adding an order line in an order placed on a Monday.

if (GetParentItem<Order>()?.OrderedAt.DayOfWeek == System.DayOfWeek.Monday)
{
    Item.Discount = 0.1M;
}

GetProperties()

Gets the properties.

public IReadOnlyCollection<IViewModelProperty> GetProperties()

Returns

IReadOnlyCollection<IViewModelProperty>

The properties.

GetProperty(string)

Gets the view model of the specified property.

public virtual IViewModelProperty GetProperty(string name)

Parameters

name string

The property name.

Returns

IViewModelProperty

The view model of the property.

Exceptions

Exception

The property does not exist.

GetSubViewModel<T>(string)

Gets the view model of the sub-view associated to the specified relation property.

public virtual ViewModel<T> GetSubViewModel<T>(string relationPropertyName) where T : class, IUIView

Parameters

relationPropertyName string

The relation property name.

Returns

ViewModel<T>

The view model of the sub-view.

Type Parameters

T

Type of the sub-view managed by the sub-view view model.

Remarks

The search based on the relation property name is not case sensitive.

Exceptions

Exception

The sub-view view model does not exist.

GetUpdateAllowed(TUIView)

Gets a value indicating whether updating an item is allowed.

public bool GetUpdateAllowed(TUIView item)

Parameters

item TUIView

Item on which the UpdateAllowed value must be checked.

Returns

bool

true if the item can be updated; otherwise, false.

GetViewModelById<T>(string)

Gets a view model by identifier.

public virtual ViewModel<T> GetViewModelById<T>(string id) where T : class, IUIView

Parameters

id string

The identifier.

Returns

ViewModel<T>

The view model.

Type Parameters

T

Type of UI view managed by the view model.

Exceptions

Exception

The view model does not exist.

GetViewModelOfViewContainer<TContainerUIView>(string)

Gets the view model of a view container in the current UIView by the specified container identifier.

public virtual ViewModel<TUIView> GetViewModelOfViewContainer<TContainerUIView>(string containerId) where TContainerUIView : class, IUIView

Parameters

containerId string

The container identifier.

Returns

ViewModel<TUIView>

The view model of the founded view container.

Type Parameters

TContainerUIView

The type of the uiview loaded in the view container.

GetVisibleProperties()

Gets the visible properties.

public IReadOnlyCollection<IViewModelProperty> GetVisibleProperties()

Returns

IReadOnlyCollection<IViewModelProperty>

The visible properties.

HideWaitingOverlayMessage()

Hides the waiting overlay message.

protected virtual void HideWaitingOverlayMessage()

ImportAsync<TItem>(IEnumerable<TItem>, bool)

Imports the specified items at the end of the datasource.

public Task<bool> ImportAsync<TItem>(IEnumerable<TItem> items, bool asNewItem = false)

Parameters

items IEnumerable<TItem>

Items to import.

asNewItem bool

A value indicating whether imported items should be considered new items.

Returns

Task<bool>

A Task representing the asynchronous operation. The task result contains true if the items have been imported, false otherwise.

Type Parameters

TItem

Item type (must contain same properties as IUIView).

ImportAsync<TItem>(params TItem[])

Imports the specified items at the end of the datasource.

public Task<bool> ImportAsync<TItem>(params TItem[] items)

Parameters

items TItem[]

Items to import.

Returns

Task<bool>

A Task representing the asynchronous operation. The task result contains true if the item have been imported, false otherwise.

Type Parameters

TItem

Item type (must contain the same properties as IUIView).

Examples

The following example shows how to add an item to the data source.

Order item = new Order();
if (await AddAsync(item))
{
    Console.WriteLine("Item added");
}
else
{
    Console.WriteLine("Item not added");
}

InsertAsync(int, IEnumerable<TUIView>, bool)

Inserts the specified items at the specified position.

public Task<bool> InsertAsync(int position, IEnumerable<TUIView> items, bool asNewItem = false)

Parameters

position int

Position.

items IEnumerable<TUIView>

Items to insert.

asNewItem bool

A value indicating whether inserted items should be considered new items.

Returns

Task<bool>

A Task representing the asynchronous operation. The task result contains true if the items have been inserted, false otherwise.

InsertAsync(int, params TUIView[])

Inserts the specified items at the specified position.

public Task<bool> InsertAsync(int position, params TUIView[] items)

Parameters

position int

Position.

items TUIView[]

Items to insert.

Returns

Task<bool>

A Task representing the asynchronous operation. The task result contains true if items have been inserted, false otherwise.

InsertNewAsync(int)

Creates a new item and inserts it at the specified position.

public Task<TUIView?> InsertNewAsync(int position)

Parameters

position int

Position.

Returns

Task<TUIView>

A Task representing the asynchronous operation. The task result contains the new item or null if inserting has been canceled.

InvokeWithWaitingOverlayAsync<T>(string, Func<Task<T>>)

Invokes an action and displays a overlay with the specified message during execution.

protected virtual Task<T> InvokeWithWaitingOverlayAsync<T>(string message, Func<Task<T>> func)

Parameters

message string

The message to display during execution.

func Func<Task<T>>

The asynchronous action to invoke.

Returns

Task<T>

A task that represents the asynchronous operation.

Type Parameters

T

The type of the action result.

IsSelected(TUIView)

Gets a value indicating whether the specified item is selected.

public virtual bool IsSelected(TUIView item)

Parameters

item TUIView

The item.

Returns

bool

true if the item is selected, otherwise false.

LoadDataAsync()

Loads data from the server via an API call.

public virtual Task LoadDataAsync()

Returns

Task

A Task representing the asynchronous operation.

NavigateAsync(NavigationOptions)

Navigates to a view.

public virtual Task NavigateAsync(NavigationOptions options)

Parameters

options NavigationOptions

Navigation options.

Returns

Task

A Task representing the asynchronous operation.

OnClosing(IUIClosingArgs)

Closing event rule.

protected virtual void OnClosing(IUIClosingArgs arguments)

Parameters

arguments IUIClosingArgs

Rule arguments.

OnDataSaved(IUIDataSavedArgs<TUIView>)

Saved event rule.

protected virtual void OnDataSaved(IUIDataSavedArgs<TUIView> arguments)

Parameters

arguments IUIDataSavedArgs<TUIView>

Rule arguments.

OnDataSaving(IUIDataSavingArgs)

Saving event rule.

protected virtual void OnDataSaving(IUIDataSavingArgs arguments)

Parameters

arguments IUIDataSavingArgs

Rule arguments.

OnInitialized()

Initialized event rule.

protected virtual void OnInitialized()

OnItemAdded()

Item added event rule.

protected virtual void OnItemAdded()

OnItemAdding(IUICancelRuleArguments)

Item adding event rule.

protected virtual void OnItemAdding(IUICancelRuleArguments arguments)

Parameters

arguments IUICancelRuleArguments

Rule arguments.

OnItemCloning(IUIItemCloningArgs<TUIView>)

Item cloning event rule.

protected virtual void OnItemCloning(IUIItemCloningArgs<TUIView> arguments)

Parameters

arguments IUIItemCloningArgs<TUIView>

Rule arguments.

OnItemRemoved()

Item removed event rule.

protected virtual void OnItemRemoved()

OnItemRemoving(IUIItemRemovingArgs)

Item removing event rule.

protected virtual void OnItemRemoving(IUIItemRemovingArgs arguments)

Parameters

arguments IUIItemRemovingArgs

Rule arguments.

OnItemSelectionChanged()

Item selection changed event rule.

protected virtual void OnItemSelectionChanged()

OnItemSelectionChanging(IUICancelRuleArguments)

Item selection changing event rule.

protected virtual void OnItemSelectionChanging(IUICancelRuleArguments arguments)

Parameters

arguments IUICancelRuleArguments

Rule arguments.

OnNavigating(IUINavigatingArgs)

Navigating event rule.

protected virtual void OnNavigating(IUINavigatingArgs arguments)

Parameters

arguments IUINavigatingArgs

Rule arguments.

OnPositionChanged()

Position changed event rule.

protected virtual void OnPositionChanged()

OnPositionChanging(IUIPositionChangingArgs)

Position changing event rule.

protected virtual void OnPositionChanging(IUIPositionChangingArgs arguments)

Parameters

arguments IUIPositionChangingArgs

Rule arguments.

OnPropertyChanged(IUIPropertyChangedArgs<TUIView>)

Property changed event rule.

protected virtual void OnPropertyChanged(IUIPropertyChangedArgs<TUIView> arguments)

Parameters

arguments IUIPropertyChangedArgs<TUIView>

Rule arguments.

OnRemoving(IUIRemovingArgs<TUIView>)

Items removing event rule.

protected virtual void OnRemoving(IUIRemovingArgs<TUIView> arguments)

Parameters

arguments IUIRemovingArgs<TUIView>

Rule arguments.

OnRetrieved(IUIRetrievedArgs<TUIView>)

Retrieved event rule.

protected virtual void OnRetrieved(IUIRetrievedArgs<TUIView> arguments)

Parameters

arguments IUIRetrievedArgs<TUIView>

Rule arguments.

OnRetrieving(IUICancelRuleArguments)

Retrieving event rule.

protected virtual void OnRetrieving(IUICancelRuleArguments arguments)

Parameters

arguments IUICancelRuleArguments

Rule arguments.

PromptSaveAsync()

Displays the save dialog if the view model has changes.

public virtual Task<bool> PromptSaveAsync()

Returns

Task<bool>

A Task representing the asynchronous operation. The result is a value indicating whether the saving operation has succeeded or was canceled by the user.

RejectChanges()

Rejects all the changes made to the datasource since data was loaded or the last time the AcceptChanges() or RejectChanges() was called.

public void RejectChanges()

RemoveSort(string)

Removes the sort set on the specified property.

public virtual void RemoveSort(string propertyName)

Parameters

propertyName string

The property name.

ReturnItemAsync(TUIView)

Return an item.

The frame containing the UI view is closed and the specified item is returned to the element that initiated the navigation.

protected virtual Task ReturnItemAsync(TUIView item)

Parameters

item TUIView

The item.

Returns

Task

A task that represents the asynchronous operation.

SaveDataAsync()

Persists the changed items on the server.

public virtual Task<bool> SaveDataAsync()

Returns

Task<bool>

A Task representing the asynchronous operation. The result is a value indicating whether the saving operation has succeeded.

SelectAllItemsAsync()

Select all the items of the current datasource.

public virtual Task SelectAllItemsAsync()

Returns

Task

A Task representing the asynchronous operation.

SelectItemAsync(int)

Selects the item at the specified index in the datasource.

public virtual Task SelectItemAsync(int index)

Parameters

index int

The index of the item to select.

Returns

Task

A Task representing the asynchronous operation.

SelectItemAsync(TUIView)

Selects the specified item of the datasource.

public virtual Task SelectItemAsync(TUIView item)

Parameters

item TUIView

The item to select.

Returns

Task

A Task representing the asynchronous operation.

SetCloningAllowed(bool)

Sets a value indicating whether cloning an item is allowed.

public void SetCloningAllowed(bool value)

Parameters

value bool

Value to set.

SetDeletionAllowed(bool)

Sets a value indicating whether deleting an item is allowed.

public void SetDeletionAllowed(bool value)

Parameters

value bool

Value to set.

SetFilter(Filter)

Sets the filter to apply to the datasource.

public virtual void SetFilter(Filter filter)

Parameters

filter Filter

The filter.

SetSort(string, SortDirection)

Sets the sort on the specified property name.

public virtual void SetSort(string propertyName, SortDirection direction)

Parameters

propertyName string

The property name.

direction SortDirection

The sort direction to set.

SetUpdateAllowed(bool)

Sets a value indicating whether updating an item is allowed.

public void SetUpdateAllowed(bool value)

Parameters

value bool

Value to set.

ShowApiError(IApiError)

Shows an API error.

protected virtual Task ShowApiError(IApiError error)

Parameters

error IApiError

API error.

Returns

Task

A task that represents the asynchronous operation.

ShowReportAsync(ShowReportOptions)

Shows a report.

public virtual Task ShowReportAsync(ShowReportOptions options)

Parameters

options ShowReportOptions

Options.

Returns

Task

A Task representing the asynchronous operation.

SortAsync()

Sorts the data in the datasource based on the sorts set in DataSorts.

When all data is loaded or when sorting an embedded sub-view model, sorting is done on the client side. Otherwise, sorting is done on the server side and sorted data is sent back to the client.

public virtual Task SortAsync()

Returns

Task

A Task representing the asynchronous operation.

UnselectAllItemsAsync()

Unselects all the items of the current datasource.

public virtual Task UnselectAllItemsAsync()

Returns

Task

A Task representing the asynchronous operation.

UnselectItemAsync(int)

Unselects the item at the specified index in the datasource.

public virtual Task UnselectItemAsync(int index)

Parameters

index int

The index of the item to unselect.

Returns

Task

A Task representing the asynchronous operation.

UnselectItemAsync(TUIView)

Unselects the specified item of the datasource.

public virtual Task UnselectItemAsync(TUIView item)

Parameters

item TUIView

The item to unselect.

Returns

Task

A Task representing the asynchronous operation.

ValidateDataAsync()

Validates the data according to the input constraints and the validation rules.

public Task<bool> ValidateDataAsync()

Returns

Task<bool>

true if the data are valid, false otherwise.