Esempio n. 1
0
        private void RenderDeleteButton(GridRendererContext rendererContext, PermissionContext permissionContext)
        {
            if (!permissionContext.HasDeleteItemPermission ||
                !rendererContext.GridConfiguration.InlineEditOptions.AllowDeleting)
            {
                return;
            }

            var localActualItem = rendererContext.ActualItem;

            rendererContext.OpenElement(HtmlTagNames.Div, "action-button");
            rendererContext.AddOnClickEvent(
                EventCallback.Factory.Create(this, (MouseEventArgs e) =>
            {
                if (rendererContext.GridConfiguration.DeleteItemOptions.UseConfirmationDialog)
                {
                    rendererContext.FlexGridContext.SelectItem(localActualItem);
                    flexGridInterop.ShowModal(DeleteItemOptions.DialogName);
                }
                else
                {
                    rendererContext.TableDataSet.DeleteItem(localActualItem);
                    rendererContext.RequestRerenderNotification?.Invoke();
                }
            })
                );

            rendererContext.OpenElement(HtmlTagNames.Span, "action-button-span");
            rendererContext.OpenElement(HtmlTagNames.I, "fas fa-trash-alt");
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
        }
Esempio n. 2
0
        private void BuildCreateItemButtonRendererTree(GridRendererContext rendererContext, PermissionContext permissionContext)
        {
            rendererContext.OpenElement(HtmlTagNames.TableHeadCell, rendererContext.CssClasses.TableHeaderCell);
            rendererContext.OpenElement(HtmlTagNames.Div, "create-button-wrapper");

            rendererContext.OpenElement(HtmlTagNames.Button, "action-button");
            rendererContext.AddOnClickEvent(
                EventCallback.Factory.Create(this, (MouseEventArgs e) =>
                                             flexGridInterop.ShowModal(CreateItemOptions.CreateItemModalName))
                );

            rendererContext.OpenElement(HtmlTagNames.Span, "action-button-span");
            rendererContext.OpenElement(HtmlTagNames.I, "fas fa-plus");
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
        }
        private void BuildCreateItemButtonRendererTree(GridRendererContext rendererContext, PermissionContext permissionContext)
        {
            rendererContext.OpenElement(HtmlTagNames.TableHeadCell, rendererContext.CssClasses.TableHeaderCell);
            rendererContext.OpenElement(HtmlTagNames.Div, "create-button-wrapper");

            rendererContext.OpenElement(HtmlTagNames.Button, "action-button");
            rendererContext.AddOnClickEvent(() =>
                                            BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
                                                                             FlexGridInterop.ShowModal(CreateItemOptions.CreateItemModalName))
                                            );

            rendererContext.OpenElement(HtmlTagNames.Span, "action-button-span");
            rendererContext.OpenElement(HtmlTagNames.I, "fas fa-plus");
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
        }