public void AddEditField(EditInputRendererTree editInputRendererTree, PermissionContext permissionContext)
        {
            if (!ActualColumnPropertyCanBeEdited ||
                !permissionContext.HasCurrentUserWritePermission(ActualColumnName))
            {
                AddActualColumnValue(permissionContext);

                return;
            }

            if (columnEditRendererBuilders.TryGetValue(ActualColumnName, out var builder))
            {
                var editColumnContext       = new EditColumnContext(ActualColumnName, TableDataSet.EditItemProperty);
                var rendererFragmentAdapter = builder.Invoke(editColumnContext);
                var fragment = rendererFragmentAdapter.GetColumnFragment(ActualItem);
                RendererTreeBuilder.AddContent(fragment);

                return;
            }

            editInputRendererTree.BuildInputRendererTree(
                RendererTreeBuilder,
                this,
                TableDataSet.EditItemProperty);
        }
Ejemplo n.º 2
0
        protected override void BuildRendererTreeInternal(GridRendererContext rendererContext, PermissionContext permissionContext)
        {
            rendererContext.OpenElement(HtmlTagNames.TableColumn, rendererContext.CssClasses.TableCell);

            if (!rendererContext.IsActualItemEdited)
            {
                rendererContext.AddActualColumnValue(permissionContext);
                rendererContext.CloseElement();

                return;
            }

            if (rendererContext.ActualColumnPropertyCanBeEdited && permissionContext.HasCurrentUserWritePermission(rendererContext.ActualColumnName))
            {
                editInputRendererTree.BuildInputRendererTree(
                    rendererContext.RendererTreeBuilder,
                    rendererContext,
                    rendererContext.TableDataSet.EditItemProperty);
            }
            else
            {
                rendererContext.AddActualColumnValue(permissionContext);
            }

            rendererContext.CloseElement();
        }
Ejemplo n.º 3
0
        protected override void BuildRendererTreeInternal(GridRendererContext rendererContext, PermissionContext permissionContext)
        {
            rendererContext.OpenElement(HtmlTagNames.TableColumn, rendererContext.CssClasses.TableCell);


            if (!rendererContext.IsActualItemEdited)
            {
                var localActualItem = rendererContext.ActualItem;

                rendererContext.AddOnClickEvent(
                    () => BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
                {
                    rendererContext.TableDataSet
                    .GridViewEvents
                    .OnItemClicked?.Invoke(new ItemClickedArgs {
                        Item = localActualItem
                    });
                })
                    );
            }

            if (!rendererContext.IsActualItemEdited)
            {
                rendererContext.AddActualColumnValue(permissionContext);
                rendererContext.CloseElement();

                return;
            }

            if (rendererContext.ActualColumnPropertyCanBeEdited && permissionContext.HasCurrentUserWritePermission(rendererContext.ActualColumnName))
            {
                editInputRendererTree.BuildInputRendererTree(
                    rendererContext.RendererTreeBuilder,
                    rendererContext,
                    rendererContext.TableDataSet.EditItemProperty);
            }
            else
            {
                rendererContext.AddActualColumnValue(permissionContext);
            }

            rendererContext.CloseElement();
        }