protected override async Task OnParametersSetAsync() { _renderFragments = new QueryDictionary <RenderFragment>(); foreach (var column in GridComponent.Grid.Columns) { // Name must have a non empty value if (string.IsNullOrWhiteSpace(column.Name)) { column.Name = Guid.NewGuid().ToString(); } if (((ICGridColumn)column).SubGrids != null) { var values = ((ICGridColumn)column).GetSubGridKeyValues(Item).Values.ToArray(); var grid = await((ICGridColumn)column).SubGrids(values, false, true, false, true) as ICGrid; _renderFragments.Add(column.Name, CreateSubGridComponent(grid)); } else if (column.DeleteComponentType != null) { _renderFragments.Add(column.Name, GridCellComponent <T> .CreateComponent(_sequence, column.DeleteComponentType, column, Item)); } } _tabGroups = GridComponent.Grid.Columns .Where(r => !string.IsNullOrWhiteSpace(r.TabGroup) && _renderFragments.Keys.Any(s => s.Equals(r.Name))) .Select(r => r.TabGroup).Distinct(); _shouldRender = true; }
protected override void OnParametersSet() { _renderFragments = new QueryDictionary <RenderFragment>(); _isTooltipVisible = new QueryDictionary <bool>(); foreach (var column in GridComponent.Grid.Columns) { // Name must have a non empty value if (string.IsNullOrWhiteSpace(column.Name)) { column.Name = Guid.NewGuid().ToString(); } if (column.CreateComponentType != null) { _renderFragments.Add(column.Name, GridCellComponent <T> .CreateComponent(_sequence, column.CreateComponentType, column, Item, null, true)); } _isTooltipVisible.AddParameter(column.Name, false); } _tabGroups = GridComponent.Grid.Columns .Where(r => !string.IsNullOrWhiteSpace(r.TabGroup) && _renderFragments.Keys.Any(s => s.Equals(r.Name))) .Select(r => r.TabGroup).Distinct(); _shouldRender = true; }
protected override async Task OnParametersSetAsync() { _renderFragments = new QueryDictionary <RenderFragment>(); foreach (var column in GridComponent.Grid.Columns) { // Name must have a non empty value if (string.IsNullOrWhiteSpace(column.Name)) { column.Name = Guid.NewGuid().ToString(); } if (column.CreateComponentType != null) { VariableReference reference = new VariableReference(); Children.Add(column.Name, reference); _renderFragments.Add(column.Name, GridCellComponent <T> .CreateComponent(_sequence, GridComponent, column.CreateComponentType, column, Item, null, true, reference)); } } _tabGroups = GridComponent.Grid.Columns .Where(r => !string.IsNullOrWhiteSpace(r.TabGroup) && _renderFragments.Keys.Any(s => s.Equals(r.Name))) .Select(r => r.TabGroup).Distinct(); foreach (var column in GridComponent.Grid.Columns) { if (((IGridColumn <T>)column).IsSelectColumn.IsSelectKey) { var selectItem = await((IGridColumn <T>)column).SelectItemExpr(Item); SelectItems.Add(column.Name, selectItem); } } _shouldRender = true; }
protected RenderFragment CreateComponent(int sequence, GridComponent <T> gridComponent, Type componentType, IGridColumn column, object item, int rowId) => builder => { builder.OpenComponent <CascadingValue <GridComponent <T> > >(++_sequence); builder.AddAttribute(++_sequence, "Value", gridComponent); builder.AddAttribute(++_sequence, "Name", "GridComponent"); builder.AddAttribute(++_sequence, "ChildContent", GridCellComponent <T> .CreateComponent(sequence, componentType, column, item, rowId, false)); builder.CloseComponent(); };
protected override async Task OnParametersSetAsync() { _renderFragments = new QueryDictionary <RenderFragment>(); Children = new QueryDictionary <VariableReference>(); foreach (var column in GridComponent.Grid.Columns) { // Name must have a non empty value if (string.IsNullOrWhiteSpace(column.Name)) { column.Name = Guid.NewGuid().ToString(); } if (((ICGridColumn)column).SubGrids != null) { var values = ((ICGridColumn)column).GetSubGridKeyValues(Item); var grid = await((ICGridColumn)column).SubGrids(values.Values.ToArray(), false, true, false, true) as ICGrid; grid.Direction = GridComponent.Grid.Direction; grid.FixedValues = values; VariableReference reference = new VariableReference(); Children.AddParameter(column.Name, reference); _renderFragments.AddParameter(column.Name, CreateSubGridComponent(grid, reference)); } else if (column.DeleteComponentType != null) { VariableReference reference = new VariableReference(); Children.AddParameter(column.Name, reference); _renderFragments.AddParameter(column.Name, GridCellComponent <T> .CreateComponent(GridComponent, column.DeleteComponentType, column, Item, null, true, reference)); } } _tabGroups = GridComponent.Grid.Columns .Where(r => !string.IsNullOrWhiteSpace(r.TabGroup) && _renderFragments.Keys.Any(s => s.Equals(r.Name))) .Select(r => r.TabGroup).Distinct(); if (((CGrid <T>)GridComponent.Grid).ButtonCrudComponents != null && ((CGrid <T>)GridComponent.Grid).ButtonCrudComponents.Count() > 0) { foreach (var key in ((CGrid <T>)GridComponent.Grid).ButtonCrudComponents.Keys) { var buttonCrudComponent = ((CGrid <T>)GridComponent.Grid).ButtonCrudComponents.Get(key); if ((buttonCrudComponent.DeleteMode != null && buttonCrudComponent.DeleteMode(Item)) || (buttonCrudComponent.DeleteModeAsync != null && await buttonCrudComponent.DeleteModeAsync(Item)) || (buttonCrudComponent.GridMode.HasFlag(GridMode.Delete))) { _buttonCrudComponentVisibility.AddParameter(key, true); } else { _buttonCrudComponentVisibility.AddParameter(key, false); } } } _shouldRender = true; }
protected override async Task OnParametersSetAsync() { _renderFragments = new QueryDictionary <RenderFragment>(); Children = new QueryDictionary <VariableReference>(); SelectItems = new QueryDictionary <IEnumerable <SelectItem> >(); foreach (var column in GridComponent.Grid.Columns) { // Name must have a non empty value if (string.IsNullOrWhiteSpace(column.Name)) { column.Name = Guid.NewGuid().ToString(); } if (((ICGridColumn)column).ShowCreateSubGrids && ((ICGridColumn)column).SubGrids != null) { var values = ((ICGridColumn)column).GetSubGridKeyValues(Item); var grid = await((ICGridColumn)column).SubGrids(values.Values.ToArray(), true, true, true, true) as ICGrid; grid.Direction = GridComponent.Grid.Direction; grid.FixedValues = values; VariableReference reference = new VariableReference(); Children.AddParameter(column.Name, reference); _renderFragments.AddParameter(column.Name, CreateSubGridComponent(grid, reference)); } else if (column.CreateComponentType != null) { VariableReference reference = new VariableReference(); Children.AddParameter(column.Name, reference); _renderFragments.AddParameter(column.Name, GridCellComponent <T> .CreateComponent(GridComponent, column.CreateComponentType, column, Item, null, true, reference)); } } _tabGroups = GridComponent.Grid.Columns .Where(r => !string.IsNullOrWhiteSpace(r.TabGroup) && _renderFragments.Keys.Any(s => s.Equals(r.Name))) .Select(r => r.TabGroup).Distinct(); foreach (var column in GridComponent.Grid.Columns) { if (((IGridColumn <T>)column).IsSelectColumn.IsSelectKey) { var selectItem = await((IGridColumn <T>)column).SelectItemExpr(Item); SelectItems.AddParameter(column.Name, selectItem); } } _shouldRender = true; }
protected override async Task OnParametersSetAsync() { _renderFragments = new QueryDictionary <RenderFragment>(); foreach (var column in GridComponent.Grid.Columns) { // Name must have a non empty value if (string.IsNullOrWhiteSpace(column.Name)) { column.Name = Guid.NewGuid().ToString(); } if (((ICGridColumn)column).SubGrids != null) { var values = ((ICGridColumn)column).GetSubGridKeyValues(Item); var grid = await((ICGridColumn)column).SubGrids(values.Values.ToArray(), true, true, true, true) as ICGrid; grid.Direction = GridComponent.Grid.Direction; grid.FixedValues = values; VariableReference reference = new VariableReference(); if (Children.ContainsKey(column.Name)) { Children[column.Name] = reference; } else { Children.Add(column.Name, reference); } if (_renderFragments.ContainsKey(column.Name)) { _renderFragments[column.Name] = CreateSubGridComponent(grid, reference); } else { _renderFragments.Add(column.Name, CreateSubGridComponent(grid, reference)); } } else if (column.UpdateComponentType != null) { VariableReference reference = new VariableReference(); if (Children.ContainsKey(column.Name)) { Children[column.Name] = reference; } else { Children.Add(column.Name, reference); } if (_renderFragments.ContainsKey(column.Name)) { _renderFragments[column.Name] = GridCellComponent <T> .CreateComponent(_sequence, GridComponent, column.UpdateComponentType, column, Item, null, true, reference); } else { _renderFragments.Add(column.Name, GridCellComponent <T> .CreateComponent(_sequence, GridComponent, column.UpdateComponentType, column, Item, null, true, reference)); } } } _tabGroups = GridComponent.Grid.Columns .Where(r => !string.IsNullOrWhiteSpace(r.TabGroup) && _renderFragments.Keys.Any(s => s.Equals(r.Name))) .Select(r => r.TabGroup).Distinct(); _shouldRender = true; }