Interface IViewModel
- Namespace
- GroupeIsa.Neos.Designer.UIAbstractions
- Assembly
- GroupeIsa.Neos.Designer.UIAbstractions.dll
Provides the functionalities of the MVVM view model of a UI view.
public interface IViewModel : IBaseViewModel
- Inherited Members
Properties
Actions
Gets the actions.
IViewModelActions Actions { get; }
Property Value
AddingUIViewId
Gets or sets the id of the UI view that opens to add a new item.
UIViewId? AddingUIViewId { get; set; }
Property Value
AddingUIViewName
Gets or sets the name of the UI view that opens to add a new item.
string? AddingUIViewName { get; set; }
Property Value
ApiClient
Gets the API client.
ApiClient ApiClient { get; }
Property Value
Behavior
Gets the behavior.
IUIViewBehavior Behavior { get; }
Property Value
CanMoveNextPage
Gets a value indicating whether navigating to the next page is possible.
bool CanMoveNextPage { get; }
Property Value
CanMoveNextPosition
Gets a value indicating whether the current position can be moved to the next item.
bool CanMoveNextPosition { get; }
Property Value
CanMovePreviousPage
Gets a value indicating whether navigating to the previous page is possible.
bool CanMovePreviousPage { get; }
Property Value
CanMovePreviousPosition
Gets a value indicating whether the current position can be moved to the previous item.
bool CanMovePreviousPosition { get; }
Property Value
CreatedItems
Gets the new items of the datasource.
IReadOnlyCollection<IUIView> CreatedItems { get; }
Property Value
CreationAllowed
Gets or sets a value indicating whether creating a new item is allowed.
bool CreationAllowed { get; set; }
Property Value
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.
bool CreationMode { get; set; }
Property Value
CurrentId
Gets or sets the current id.
IIdValue? CurrentId { get; set; }
Property Value
DataSorts
Gets the collection of the sorts set on the datasource.
IReadOnlyCollection<Sort> DataSorts { get; }
Property Value
Datafilter
Gets or sets the current data filter applied to the datasource.
Filter Datafilter { get; set; }
Property Value
Datasource
Gets the datasource.
IDatasource<IUIView> Datasource { get; }
Property Value
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.
IUIView? DatasourceCurrent { get; }
Property Value
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.")]
string Description { get; }
Property Value
EditingLinkPropertyName
Gets or sets the name of the property on which a link for editing the item is displayed.
string? EditingLinkPropertyName { get; set; }
Property Value
EditingUIViewId
Gets or sets the id of the UI view that opens to edit an item.
UIViewId? EditingUIViewId { get; set; }
Property Value
EditingUIViewName
Gets or sets the name of the UI view that opens to edit an item.
string? EditingUIViewName { get; set; }
Property Value
EntityName
Gets the name of the entity.
string? EntityName { get; }
Property Value
EntityViewDefaultSort
Gets the default sort of the entity view. null if the UI view is unbound.
IReadOnlyCollection<Sort>? EntityViewDefaultSort { get; }
Property Value
EntityViewName
Gets the name of the entity view.
string? EntityViewName { get; }
Property Value
FilteringBehavior
Gets the filtering behavior.
IFilteringBehavior FilteringBehavior { get; }
Property Value
GroupDescriptions
Gets the description of the groups made when grouping by a property.
List<string> GroupDescriptions { get; }
Property Value
GroupingBehavior
Gets the grouping behavior.
IGroupingBehavior GroupingBehavior { get; }
Property Value
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.
bool HasChanges { get; }
Property Value
HasErrors
Gets a value indicating whether the datasource has errors.
Relations are also taken into account recursively.
bool HasErrors { get; }
Property Value
HasMoreData
Gets a value indicating whether more data can be retrieved.
bool HasMoreData { get; }
Property Value
Icon
Gets or sets the icon.
string Icon { get; set; }
Property Value
IconId
Gets or sets the icon id.
ImageId? IconId { get; set; }
Property Value
IsMain
Gets a value indicating whether the view model is the main view model.
bool IsMain { get; }
Property Value
Loading
Gets a value indicating whether data is being loaded.
bool Loading { get; }
Property Value
LookupContext
Gets the lookup context. Only defined when UI view is open in lookup modal.
ILookupContext? LookupContext { get; }
Property Value
ModifiedItems
Gets the modified items of the datasource.
IReadOnlyCollection<IUIView> ModifiedItems { get; }
Property Value
MonoRecord
Gets or sets a value indicating whether the UI view is in mono-record mode.
bool MonoRecord { get; set; }
Property Value
NamedFilters
Gets the named filters.
List<NamedFilter> NamedFilters { get; }
Property Value
PageNumber
Gets or sets the number of the current page in the paginated data source.
int PageNumber { get; set; }
Property Value
PersistenceErrorItems
Gets the elements with at least one persistence error.
IReadOnlyCollection<IUIView> PersistenceErrorItems { get; }
Property Value
Position
Gets or sets the current position in the datasource.
int Position { get; set; }
Property Value
Examples
The following example shows how to set the position to the last element.
Position = Datasource.Count - 1;
Properties
Gets the properties.
IViewModelProperties Properties { get; }
Property Value
RecordsByPage
Gets or sets the maximum number of records retrieved by page.
int RecordsByPage { get; set; }
Property Value
Relations
Gets the relationships between the view model and the view models of the sub-views.
[Obsolete("Use Relationships instead.")]
IReadOnlyCollection<IViewModelRelation> Relations { get; }
Property Value
Relationships
Gets the relationships between the view model and the view models of the sub-views.
IReadOnlyCollection<IViewModelRelation> Relationships { get; }
Property Value
SelectedItems
Gets the selected items in the datasource.
IReadOnlyCollection<IUIView> SelectedItems { get; }
Property Value
SortingBehavior
Gets the sorting behavior.
ISortingBehavior SortingBehavior { get; }
Property Value
Title
Gets the title.
string Title { get; }
Property Value
TotalRecordCount
Gets the total record count.
int TotalRecordCount { get; }
Property Value
UIViewName
Gets the name of the UI view.
string UIViewName { get; }
Property Value
UrlContext
Gets the URL context which contains additional parameters added to the URL.
IUrlContext UrlContext { get; }
Property Value
UserStyleRules
Gets the user style rules.
IUserStyleRule[] UserStyleRules { get; }
Property Value
ValidateLocalizableString
Gets or sets a value indicating whether the localizable strings with a missing translation generate an error / warning.
bool ValidateLocalizableString { get; set; }
Property Value
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.
IViewContext ViewContext { get; }
Property Value
ViewModelId
Gets the view model identifier defined in the UI view template using the "id" attribute.
string? ViewModelId { get; }
Property Value
Methods
AcceptChanges()
Accepts all the changes made to the datasource since data was loaded or the last time the AcceptChanges() or RejectChanges() was called.
void AcceptChanges()
AddAsync(params IUIView[])
Adds the specified items at the end of the datasource.
Task<bool> AddAsync(params IUIView[] items)
Parameters
itemsIUIView[]Items to add.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif items have been added,falseotherwise.
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");
}
AddAsync(IEnumerable<IUIView>, bool)
Adds the specified items at the end of the datasource.
Task<bool> AddAsync(IEnumerable<IUIView> items, bool asNewItem = false)
Parameters
itemsIEnumerable<IUIView>Items to add.
asNewItemboolA value indicating whether added items should be considered new items.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif items have been added,falseotherwise.
AddNewAsync()
Creates a new item and adds it at the end of the datasource.
Task<IUIView?> AddNewAsync()
Returns
- Task<IUIView>
A Task representing the asynchronous operation. The task result contains the new item or
nullif 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.
void ClearSort()
CloneAsync(IUIView)
Creates a new item that is a copy of the specified source item and adds it at the end of the datasource.
Task<IUIView?> CloneAsync(IUIView source)
Parameters
sourceIUIViewThe source item from which the new item will be cloned.
Returns
- Task<IUIView>
A Task representing the asynchronous operation. The task result contains the new item that is the result of the cloning operation or
nullif cloning has been canceled.
CloseAsync(bool, NavigationResult?)
Closes the current view.
Task CloseAsync(bool displayUnsavedChangesMessage = true, NavigationResult? result = null)
Parameters
displayUnsavedChangesMessageboolA value indicating whether the unsaved changes message is displayed.
resultNavigationResultThe navigation result.
Returns
ConvertFilterFromJsonAsync(string)
Converts a JSON string to a Filter object.
Task<Filter> ConvertFilterFromJsonAsync(string json)
Parameters
jsonstringJSON.
Returns
CreateNewItem()
Creates a new item.
IUIView CreateNewItem()
Returns
- IUIView
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.
ServerDataExportOptions CreateServerDataExportOptions(string fileName, ExportFormat format)
Parameters
fileNamestringThe file name.
formatExportFormatThe format.
Returns
- ServerDataExportOptions
The server data export options.
DeleteDataAsync(params IUIView[])
Removes the specified items from the server via an API call.
Task<bool> DeleteDataAsync(params IUIView[] items)
Parameters
itemsIUIView[]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(IEnumerable<IUIView>)
Removes the specified items from the server via an API call.
Task<bool> DeleteDataAsync(IEnumerable<IUIView> items)
Parameters
itemsIEnumerable<IUIView>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.
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.
EnsureDataLoadedAsync()
Ensures data is loaded.
Task EnsureDataLoadedAsync()
Returns
Remarks
This method should be used exclusively for sub-view models that are not configured for automatic loading.
ExecuteRemoveActionAsync()
Executes the Remove action.
Task ExecuteRemoveActionAsync()
Returns
- Task
A Task representing the asynchronous operation. The task result contains a value indicating whether the items have been removed.
ExecuteReportAsync(ReportId, Filter?, Dictionary<string, object>?)
Executes a report.
Task ExecuteReportAsync(ReportId reportId, Filter? filter = null, Dictionary<string, object>? parameters = null)
Parameters
reportIdReportIdReport id.
filterFilterFilter to apply to the data.
parametersDictionary<string, object>Parameters to pass to the report.
Returns
ExecuteReportAsync(string, Filter?, Dictionary<string, object>?)
Executes a report.
[Obsolete("Using string literals for report name is error-prone. Use new ExecuteReportAsync(Reports.MyReport...) to benefit from compile-time safety.", false)]
Task ExecuteReportAsync(string reportName, Filter? filter = null, Dictionary<string, object>? parameters = null)
Parameters
reportNamestringReport name.
filterFilterFilter to apply to the data.
parametersDictionary<string, object>Parameters to pass to the report.
Returns
ExecuteReportWithOptionsAsync(ExecuteReportOptions)
Executes a report.
Task ExecuteReportWithOptionsAsync(ExecuteReportOptions options)
Parameters
optionsExecuteReportOptionsOptions.
Returns
FilterDataAsync()
Filters the data based on the current filter.
Task FilterDataAsync()
Returns
FilterDataAsync(Filter)
Filters the data based on the specified filter.
Task FilterDataAsync(Filter filter)
Parameters
filterFilterThe filter to apply.
Returns
FindSort(string)
Finds the sort set on the specified property.
Sort? FindSort(string propertyName)
Parameters
propertyNamestringThe 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.
int FindSortIndex(string propertyName)
Parameters
propertyNamestringThe 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.
ViewModel<T>? FindSubViewModel<T>(string relationPropertyName) where T : class, IUIView
Parameters
relationPropertyNamestringThe relation property name.
Returns
- ViewModel<T>
The view model of the sub-view or
nullif it does not exist.
Type Parameters
TType 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.
ViewModel<T>? FindViewModelById<T>(string id) where T : class, IUIView
Parameters
idstringThe identifier.
Returns
- ViewModel<T>
The view model or
nullif it does not exist.
Type Parameters
TType 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.
ViewModel<TContainerUIView>? FindViewModelOfViewContainer<TContainerUIView>(string containerId) where TContainerUIView : class, IUIView
Parameters
containerIdstringThe container identifier.
Returns
- ViewModel<TContainerUIView>
The view model of the found view container or
nullwhen the view container was not found.
Type Parameters
TContainerUIViewThe type of the UI view loaded in the view container.
GetAction(string)
Gets the view model of the specified action.
IViewModelAction GetAction(string name)
Parameters
namestringThe action name.
Returns
- IViewModelAction
The view model of the action.
Exceptions
- Exception
The action does not exist.
GetCloningAllowed(IUIView)
Gets a value indicating whether cloning an item is allowed.
bool GetCloningAllowed(IUIView item)
Parameters
itemIUIViewItem on which the
CloningAllowedvalue must be checked.
Returns
- bool
trueif the item can be cloned; otherwise,false.
GetDeletionAllowed(IUIView)
Gets a value indicating whether deleting an item is allowed.
bool GetDeletionAllowed(IUIView item)
Parameters
itemIUIViewItem on which the
DeletionAllowedvalue must be checked.
Returns
- bool
trueif the item can be deleted; otherwise,false.
GetDisplayableProperties()
Gets the displayable properties.
IReadOnlyCollection<IViewModelProperty> GetDisplayableProperties()
Returns
- IReadOnlyCollection<IViewModelProperty>
The displayable properties.
GetEntityViewParameters()
Gets the entity view parameters.
IViewModelEntityViewParameter<object?>[] GetEntityViewParameters()
Returns
- IViewModelEntityViewParameter<object>[]
The entity view parameters.
GetFilterableProperties()
Gets the filterable properties.
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.
IDatasource<IUIView> GetFullDatasource()
Returns
- IDatasource<IUIView>
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.
IFrame? GetOwnerFrame()
Returns
- IFrame
The owner frame or
nullif this UI view does not belong to a frame.
GetParentItem<TParentUIView>()
Gets the parent item that this data source is in relation with.
TParentUIView? GetParentItem<TParentUIView>() where TParentUIView : class, IUIView
Returns
- TParentUIView
Parent item or
nullwhen this data source does not belong to a relationship.
Type Parameters
TParentUIViewType 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;
}
GetPermissions()
Gets the current permissions.
Permissions GetPermissions()
Returns
- Permissions
The permissions.
GetProperties()
Gets the properties.
IReadOnlyCollection<IViewModelProperty> GetProperties()
Returns
- IReadOnlyCollection<IViewModelProperty>
The properties.
GetProperty(string)
Gets the view model of the specified property.
IViewModelProperty GetProperty(string name)
Parameters
namestringThe 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.
ViewModel<T> GetSubViewModel<T>(string relationPropertyName) where T : class, IUIView
Parameters
relationPropertyNamestringThe relation property name.
Returns
- ViewModel<T>
The view model of the sub-view.
Type Parameters
TType 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(IUIView)
Gets a value indicating whether updating an item is allowed.
bool GetUpdateAllowed(IUIView item)
Parameters
itemIUIViewItem on which the
UpdateAllowedvalue must be checked.
Returns
- bool
trueif the item can be updated; otherwise,false.
GetViewModelById<T>(string)
Gets a view model by identifier.
ViewModel<T> GetViewModelById<T>(string id) where T : class, IUIView
Parameters
idstringThe identifier.
Returns
- ViewModel<T>
The view model.
Type Parameters
TType 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.
ViewModel<IUIView> GetViewModelOfViewContainer<TContainerUIView>(string containerId) where TContainerUIView : class, IUIView
Parameters
containerIdstringThe container identifier.
Returns
Type Parameters
TContainerUIViewThe type of the uiview loaded in the view container.
GetVisibleProperties()
Gets the visible properties.
IReadOnlyCollection<IViewModelProperty> GetVisibleProperties()
Returns
- IReadOnlyCollection<IViewModelProperty>
The visible properties.
ImportAsync<TItem>(IEnumerable<TItem>, bool)
Imports the specified items at the end of the datasource.
Task<bool> ImportAsync<TItem>(IEnumerable<TItem> items, bool asNewItem = false)
Parameters
itemsIEnumerable<TItem>Items to import.
asNewItemboolA value indicating whether imported items should be considered new items.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the items have been imported,falseotherwise.
Type Parameters
TItemItem type (must contain same properties as IUIView).
ImportAsync<TItem>(params TItem[])
Imports the specified items at the end of the datasource.
Task<bool> ImportAsync<TItem>(params TItem[] items)
Parameters
itemsTItem[]Items to import.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the item have been imported,falseotherwise.
Type Parameters
TItemItem 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, params IUIView[])
Inserts the specified items at the specified position.
Task<bool> InsertAsync(int position, params IUIView[] items)
Parameters
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif items have been inserted,falseotherwise.
InsertAsync(int, IEnumerable<IUIView>, bool)
Inserts the specified items at the specified position.
Task<bool> InsertAsync(int position, IEnumerable<IUIView> items, bool asNewItem = false)
Parameters
positionintPosition.
itemsIEnumerable<IUIView>Items to insert.
asNewItemboolA value indicating whether inserted items should be considered new items.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the items have been inserted,falseotherwise.
InsertNewAsync(int)
Creates a new item and inserts it at the specified position.
Task<IUIView?> InsertNewAsync(int position)
Parameters
positionintPosition.
Returns
- Task<IUIView>
A Task representing the asynchronous operation. The task result contains the new item or
nullif inserting has been canceled.
IsSelected(IUIView)
Gets a value indicating whether the specified item is selected.
bool IsSelected(IUIView item)
Parameters
itemIUIViewThe item.
Returns
- bool
trueif the item is selected, otherwisefalse.
LoadDataAsync()
Loads data from the server via an API call.
Task LoadDataAsync()
Returns
LoadGroupSummariesAsync(IEnumerable<IViewModelProperty>, IEnumerable<SummaryRequest>)
Loads group summaries for the specified requests.
Task<IGroupSummaryResult[]> LoadGroupSummariesAsync(IEnumerable<IViewModelProperty> groupProperties, IEnumerable<SummaryRequest> requests)
Parameters
groupPropertiesIEnumerable<IViewModelProperty>Properties on which the summaries are grouped.
requestsIEnumerable<SummaryRequest>Requests for which to load summaries.
Returns
- Task<IGroupSummaryResult[]>
Result containing the loaded group summaries.
LoadMoreDataAsync()
Loads more data from the server via an API call.
Task LoadMoreDataAsync()
Returns
LoadMoreDataAsync(int)
Loads more data from the server via an API call.
Task LoadMoreDataAsync(int top)
Parameters
topintNumber of records to load.
Returns
LoadSummariesAsync(IEnumerable<SummaryRequest>)
Loads summaries for the specified requests.
Task<ISummaryResult> LoadSummariesAsync(IEnumerable<SummaryRequest> requests)
Parameters
requestsIEnumerable<SummaryRequest>Requests for which to load summaries.
Returns
- Task<ISummaryResult>
Result containing the loaded summaries.
MarkAsChanged()
Forces this instance to be marked as modified, regardless of whether any of its properties have actually changed.
void MarkAsChanged()
Remarks
Once invoked, the HasChanges property will always return
true, signaling to the caller or underlying framework that the entity
should be treated as having pending modifications.
MoveToFirstPositionAsync()
Moves the current position to the first visible item in the grid, selects it and unselects the others.
Task<bool> MoveToFirstPositionAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the position has changed,falseotherwise.
MoveToLastPositionAsync()
Moves the current position to the last visible item in the grid, selects it and unselects the others.
Task<bool> MoveToLastPositionAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the position has changed,falseotherwise.
MoveToNextPositionAsync()
Moves the current position to the next visible item in the grid, selects it and unselects the others.
Task<bool> MoveToNextPositionAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the position has changed,falseotherwise.
MoveToPreviousPositionAsync()
Moves the current position to the previous visible item in the grid, selects it and unselects the others.
Task<bool> MoveToPreviousPositionAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the position has changed,falseotherwise.
NavigateAsync(NavigationOptions)
Navigates to a UI view. It will call the Navigating event rule.
Task NavigateAsync(NavigationOptions options)
Parameters
optionsNavigationOptionsNavigation options.
Returns
PromptSaveAsync()
Displays the save dialog if the view model has changes.
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.
void RejectChanges()
ReloadDataAsync(IUIView)
Reloads the specified item from the server via an API call.
Task ReloadDataAsync(IUIView item)
Parameters
itemIUIViewItem to reload.
Returns
ReloadDataAsync(IEnumerable<IUIView>)
Reloads the specified items from the server via an API call.
Task ReloadDataAsync(IEnumerable<IUIView> items)
Parameters
itemsIEnumerable<IUIView>Items to reload.
Returns
RemoveSort(string)
Removes the sort set on the specified property.
void RemoveSort(string propertyName)
Parameters
propertyNamestringThe property name.
SaveDataAsync()
Persists the changed items on the server.
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.
Task SelectAllItemsAsync()
Returns
SelectItemAsync(IUIView)
Selects the specified item of the datasource.
Task SelectItemAsync(IUIView item)
Parameters
itemIUIViewThe item to select.
Returns
SelectItemAsync(int)
Selects the item at the specified position in the datasource.
Task SelectItemAsync(int position)
Parameters
positionintThe position of the item to select.
Returns
SetCloningAllowed(bool)
Sets a value indicating whether cloning an item is allowed.
void SetCloningAllowed(bool value)
Parameters
valueboolValue to set.
SetCurrentAndSelectAsync(IUIView)
Sets the current item, selects it and unselects the others.
Task SetCurrentAndSelectAsync(IUIView item)
Parameters
itemIUIViewThe item to select.
Returns
SetDeletionAllowed(bool)
Sets a value indicating whether deleting an item is allowed.
void SetDeletionAllowed(bool value)
Parameters
valueboolValue to set.
SetFilter(Filter)
Sets the filter to apply to the datasource.
void SetFilter(Filter filter)
Parameters
filterFilterThe filter.
SetPositionAndSelectAsync(int)
Sets the position of the current item, selects it and unselects the others.
Task SetPositionAndSelectAsync(int position)
Parameters
positionintThe position of the item to select.
Returns
SetSort(string, SortDirection)
Sets the sort on the specified property name.
void SetSort(string propertyName, SortDirection direction)
Parameters
propertyNamestringThe property name.
directionSortDirectionThe sort direction to set.
SetUpdateAllowed(bool)
Sets a value indicating whether updating an item is allowed.
void SetUpdateAllowed(bool value)
Parameters
valueboolValue to set.
ShowReportAsync(ShowReportOptions)
Shows a report.
Task ShowReportAsync(ShowReportOptions options)
Parameters
optionsShowReportOptionsOptions.
Returns
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.
Task SortAsync()
Returns
UnmarkAsChanged()
Cancels this instance to be marked as modified.
void UnmarkAsChanged()
Remarks
Once invoked, the HasChanges property will return false,
if there is no pending modifications, otheriwse it will return true.
UnselectAllItemsAsync()
Unselects all the items of the current datasource.
Task UnselectAllItemsAsync()
Returns
UnselectItemAsync(IUIView)
Unselects the specified item of the datasource.
Task UnselectItemAsync(IUIView item)
Parameters
itemIUIViewThe item to unselect.
Returns
UnselectItemAsync(int)
Unselects the item at the specified position in the datasource.
Task UnselectItemAsync(int position)
Parameters
positionintThe position of the item to unselect.
Returns
ValidateDataAsync()
Validates the modified items according to the input constraints and the validation rules.
Task<bool> ValidateDataAsync()
Returns
ValidateDataAsync(bool)
Validates the data according to the input constraints and the validation rules.
Task<bool> ValidateDataAsync(bool validateUnchangedItems)
Parameters
validateUnchangedItemsboolIf set to
true, validates all items including unchanged ones; otherwise, only modified items are validated.