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 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>();
            _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 (((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.FixedValues = values;
                    _renderFragments.Add(column.Name, CreateSubGridComponent(grid));
                }
                else if (column.UpdateComponentType != null)
                {
                    _renderFragments.Add(column.Name, GridCellComponent <T> .CreateComponent(_sequence,
                                                                                             column.UpdateComponentType, 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;
        }
Example #4
0
        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;
        }
 public void DisplayTooltip(string columnName)
 {
     _isTooltipVisible.AddParameter(columnName, true);
     _shouldRender = true;
     StateHasChanged();
 }