示例#1
0
        protected override IGridCellBuilder CreateHeaderBuilderCore()
        {
            IGridCellBuilder builder = null;

            HeaderHtmlAttributes.Add("data-field", Member);
            HeaderHtmlAttributes.Add("data-title", Title);
            if (!Groupable)
            {
                HeaderHtmlAttributes.Add("data-groupable", "false");
            }

            AppendAggregateAttributes();

            if (Sortable && Grid.Sortable.Enabled && !HeaderTemplate.HasValue())
            {
                builder = new GridSortableHeaderCellBuilder(HeaderHtmlAttributes, GetSortUrl(), SortDirection, AppendHeaderContent);
            }
            else
            {
                builder = base.CreateHeaderBuilderCore();
            }

            if (Filterable && Grid.Filterable.Enabled && !Grid.ColumnMenu.Enabled)
            {
                var filtered = Grid.DataSource.Filters
                               .SelectMemberDescriptors()
                               .Any(filter => filter.Member.IsCaseInsensitiveEqual(Member));

                builder.Decorators.Add(new GridFilterCellDecorator(filtered));
            }

            return(builder);
        }
        protected override IGridCellBuilder CreateHeaderBuilderCore()
        {
            IGridCellBuilder builder = null;

            if (Sortable && Grid.Sorting.Enabled && !HeaderTemplate.HasValue())
            {
                builder = new GridSortableHeaderCellBuilder(HeaderHtmlAttributes, GetSortUrl(), SortDirection, Grid.Localization.SortedAsc, Grid.Localization.SortedDesc, AppendHeaderContent);
            }
            else
            {
                builder = base.CreateHeaderBuilderCore();
            }

            if (Filterable && Grid.Filtering.Enabled)
            {
                var filtered = Grid.DataProcessor.FilterDescriptors
                               .SelectMemberDescriptors()
                               .Any(filter => filter.Member.IsCaseInsensitiveEqual(Member));

                builder.Decorators.Add(new GridFilterCellDecorator(filtered, Grid.Localization.Filter));
            }

            return(builder);
        }