Ejemplo n.º 1
0
        private void RenderTabs(
            GridRendererContext rendererContext,
            PermissionContext permissionContext,
            IMasterTableDataSet masterTableDataSet,
            ITableDataAdapter selectedDataAdapter)
        {
            foreach (var dataAdapter in masterTableDataSet.DetailDataAdapters)
            {
                RenderTab(rendererContext, masterTableDataSet, selectedDataAdapter, dataAdapter);
            }

            if (rendererContext.ShowExplicitDetailTables())
            {
                return;
            }

            foreach (var collectionProperty in rendererContext.GridItemCollectionProperties)
            {
                if (permissionContext.HasCurrentUserReadPermission(collectionProperty.Name))
                {
                    var dataAdapter = _tableDataAdapterProvider.CreateCollectionTableDataAdapter(rendererContext.ActualItem, collectionProperty);
                    RenderTab(rendererContext, masterTableDataSet, selectedDataAdapter, dataAdapter);
                }
            }
        }
Ejemplo n.º 2
0
        protected override void BuildRenderTreeInternal(GridRendererContext rendererContext, PermissionContext permissionContext)
        {
            using (new MeasurableScope(sw => logger.LogInformation($"Grid grouped body rendering duration {sw.ElapsedMilliseconds}ms")))
            {
                rendererContext.OpenElement(HtmlTagNames.TableBody, rendererContext.CssClasses.TableBody);
                foreach (var group in rendererContext.TableDataSet.GroupedItems)
                {
                    try
                    {
                        rendererContext.OpenElement(HtmlTagNames.TableRow, rendererContext.CssClasses.TableGroupRow);
                        rendererContext.OpenElement(HtmlTagNames.TableColumn, rendererContext.CssClasses.TableGroupRowCell);
                        rendererContext.AddAttribute(HtmlAttributes.Colspan, rendererContext.NumberOfColumns);
                        rendererContext.OpenElement(HtmlTagNames.Button, "pagination-button");
                        rendererContext.AddOnClickEvent(
                            EventCallback.Factory.Create(this, (MouseEventArgs e) =>
                        {
                            rendererContext.TableDataSet.ToggleGroupRow(group.Key);
                            rendererContext.RequestRerenderNotification?.Invoke();
                        })
                            );
                        rendererContext.OpenElement(HtmlTagNames.Span, "pagination-button-arrow");
                        rendererContext.OpenElement(HtmlTagNames.I, !group.IsCollapsed ? "fas fa-angle-down" : "fas fa-angle-right");
                        rendererContext.CloseElement();
                        rendererContext.CloseElement();
                        rendererContext.CloseElement();
                        rendererContext.AddMarkupContent($"\t<b>{rendererContext.TableDataSet.GroupingOptions.GroupedProperty.Name}:</b> {group.Key.ToString()}\t");
                        rendererContext.OpenElement(HtmlTagNames.I);
                        rendererContext.AddContent($"({group.Count})");
                        rendererContext.CloseElement();


                        if (!group.IsCollapsed)
                        {
                            var dataAdapter        = tableDataAdapterProvider.CreateCollectionTableDataAdapter(rendererContext.TableDataSet.UnderlyingTypeOfItem(), group);
                            var masterTableFeature = rendererContext.FlexGridContext.Features.Get <IMasterTableFeature>();
                            dataAdapter = tableDataAdapterProvider.CreateMasterTableDataAdapter(dataAdapter, masterTableFeature);

                            rendererContext.AddGridViewComponent(dataAdapter);
                        }

                        rendererContext.CloseElement();
                        rendererContext.CloseElement();
                    }
                    catch (Exception ex)
                    {
                        logger.LogError($"Error occured during rendering grouped grid view body. Ex: {ex}");

                        throw ex;
                    }
                }

                rendererContext.CloseElement();
            }
        }
Ejemplo n.º 3
0
        private void RenderTabs(GridRendererContext rendererContext, IMasterTableDataSet masterTableDataSet, ITableDataAdapter selectedDataAdapter)
        {
            foreach (var dataAdapter in masterTableDataSet.DetailDataAdapters)
            {
                RenderTab(rendererContext, masterTableDataSet, selectedDataAdapter, dataAdapter);
            }

            foreach (var collectionProperty in rendererContext.GridItemCollectionProperties)
            {
                var dataAdapter = tableDataAdapterProvider.CreateCollectionTableDataAdapter(rendererContext.ActualItem, collectionProperty);
                RenderTab(rendererContext, masterTableDataSet, selectedDataAdapter, dataAdapter);
            }
        }
        public void ToggleRowItem(object item)
        {
            tableDataSet.ToggleRowItem(item);
            if (selectedDataAdapters.ContainsKey(item))
            {
                return;
            }

            var tableDataAdapter = default(ITableDataAdapter);

            if (tableDataAdapters.Any())
            {
                tableDataAdapter = tableDataAdapterProvider.ConvertToDetailTableDataAdapter(
                    tableDataAdapters.First(), item);
            }
            else
            {
                tableDataAdapter = tableDataAdapterProvider.CreateCollectionTableDataAdapter(
                    item, gridConfiguration.ClrTypeCollectionProperties.First());
            }

            selectedDataAdapters.Add(item, tableDataAdapter);
        }