Ejemplo n.º 1
0
 /// <summary>
 /// Provides the base method for handling view events.
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">View event</param>
 /// <param name="token">Cancellation token.</param>
 protected virtual async Task OnViewEventsAsync(object sender, ViewEvent e, CancellationToken token = default)
 {
     if (e.IsChild() && (e.IsOpened(false) || e.IsClosed(false)))
     {
         Model.OpenInlineViews = OpenInlineViews;
     }
     await InvokeAsync(() => StateHasChanged());
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles child closing or change to refresh the list.
        /// </summary>
        /// <param name="childViewModel">Child view model that fired the original event</param>
        /// <param name="e">Event object</param>
        protected override void OnChildEvent(object childViewModel, ViewEvent e)
        {
            if (e.IsClosed() && List != null)
            {
                List.ClearSelectedRows();
                List.FireCollectionChanged();
            }
            if (e.IsSaved() || e.IsDeleted())
            {
                Search(true);
            }

            base.OnChildEvent(childViewModel, e);
        }
Ejemplo n.º 3
0
        protected override void OnChildEvent(object sender, ViewEvent e)
        {
            ViewSelectionEvent selEvt = e as ViewSelectionEvent;
            ViewModel          child  = sender as ViewModel;

            if (selEvt != null && child != null && child.Params[ViewParams.QuerySource] == "lnkCustomerLookupLookUp")
            {
                lnkCustomerLookupLookUp_HandleResult(sender, selEvt.SelectedRows);
            }
            if (e.IsClosed() && child != null && child.Params[ViewParams.QuerySource] == "lnkDetailDetails")
            {
                this.obj.DetailList.ClearSelectedRows();
            }
            base.OnChildEvent(sender, e);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates selection in the specified list object for a details open/close event
        /// using the provided key property on the details view object.
        /// </summary>
        /// <param name="list">Data list object to update.</param>
        /// <param name="keyChildProp">The key property on the child details view.</param>
        /// <param name="e">Open/close event of the child details view.</param>
        /// <returns></returns>
        protected virtual bool UpdateListSelection(DataListObject list, DataProperty keyChildProp, ViewEvent e)
        {
            // Find key property in the list with the same name, as the key property in the child details object.
            var keyListProp = list?.Properties?.Where(p => p.IsKey && p.Name == keyChildProp?.Name)?.FirstOrDefault();

            if (keyListProp != null)
            {
                if (e.IsOpened())
                {
                    list.SelectedRows = list.GetData().Where(r => Equals(keyListProp.GetValue(ValueFormat.Internal, r),
                                                                         keyChildProp.InternalValue)).ToList();
                }
                else if (e.IsClosed())
                {
                    list.ClearSelectedRows();
                }
                return(true);
            }
            return(false);
        }