Exemple #1
0
        //bool EnabledRender = true;

        //protected override bool ShouldRender()
        //{
        //    return EnabledRender;
        //}

        protected override Task OnParametersSetAsync()
        {
            //BlazorWindowHelper.BlazorTimeAnalyzer.LogAllAdd = true;

            bvgGrid = new BvgGrid
            {
                IsReady        = true,
                Name           = TableName,
                RowsTotalCount = SourceList.Count(),
                bvgSettings    = bvgSettings,
                AllProps       = typeof(TItem).GetProperties(BindingFlags.Public | BindingFlags.Instance),
                SortState      = Tuple.Create(false, new BvgColumn()),
            };


            bvgGrid.ColumnsOrderedList          = ColumnsHelper.GetColumnsOrderedList(bvgGrid);
            bvgGrid.ColumnsOrderedListFrozen    = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen).ToArray();
            bvgGrid.ColumnsOrderedListNonFrozen = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen == false).ToArray();


            ColProp[] c = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen == false).ToArray();

            bvgGrid.NonFrozenColwidthSumsByElement = new int[c.Count()];
            int j = 0;

            for (int i = 0; i < c.Count(); i++)
            {
                j += c[i].ColWidth;
                bvgGrid.NonFrozenColwidthSumsByElement[i] = j;
            }

            c = null;


            SortedRowsList = SourceList.ToArray();

            return(base.OnParametersSetAsync());
        }
Exemple #2
0
        private void Reset(bool LoadColumnsFromSettings)
        {
            FirstLoad    = true;
            ActualRender = true;

            LastHorizontalSkip = -1;

            LastHorizontalScrollPosition = 0;


            if (bvgGrid != null)
            {
                bvgGridTransferableState = new BvgGridTransferableState <TItem>(bvgGrid);
            }
            else
            {
                bvgGridTransferableState = new BvgGridTransferableState <TItem>();
            }

            bvgGrid = new BvgGrid <TItem>
            {
                IsReady         = true,
                Name            = TableName,
                RowsTotalCount  = SourceList.Count(),
                bvgSettings     = bvgSettings,
                AllProps        = typeof(TItem).GetProperties(BindingFlags.Public | BindingFlags.Instance),
                HasMeasuredRect = bvgGridTransferableState.HasMeasuredRect,
                bvgSize         = bvgGridTransferableState.bvgSize,
            };

            bvgGrid.bvgModal.bvgGrid = bvgGrid;

            if (bvgGridTransferableState.ContaintState)
            {
                bvgGrid.cssHelper = bvgGridTransferableState.cssHelper;
            }

            if (bvgGridTransferableState.ContaintState && !LoadColumnsFromSettings)
            {
                bvgGrid.ColumnsOrderedList          = bvgGridTransferableState.ColumnsOrderedList;
                bvgGrid.ColumnsOrderedListFrozen    = bvgGridTransferableState.ColumnsOrderedListFrozen;
                bvgGrid.ColumnsOrderedListNonFrozen = bvgGridTransferableState.ColumnsOrderedListNonFrozen;
            }
            else
            {
                bvgGrid.ColumnsOrderedList = ColumnsHelper <TItem> .GetColumnsOrderedList(bvgGrid);

                bvgGrid.ColumnsOrderedListFrozen    = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen).ToArray();
                bvgGrid.ColumnsOrderedListNonFrozen = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen == false).ToArray();
            }


            bvgGrid.UpdateNonFrozenColwidthSumsByElement();

            if (bvgSettings.SortedColumn.Item1)
            {
                bvgGrid.SortState = Tuple.Create(bvgSettings.SortedColumn.Item1, bvgSettings.SortedColumn.Item2, bvgSettings.SortedColumn.Item3);


                if (bvgSettings.SortedColumn.Item3)
                {
                    SortedRowsList = GenericAdapter <TItem> .GetSortedRowsList(SourceList.AsQueryable(), bvgSettings.SortedColumn.Item2).ToArray();
                }
                else
                {
                    SortedRowsList = GenericAdapter <TItem> .GetSortedRowsList(SourceList.AsQueryable(), bvgSettings.SortedColumn.Item2 + " desc").ToArray();
                }
            }
            else
            {
                bvgGrid.SortState = Tuple.Create(false, string.Empty, false);

                SortedRowsList = SourceList.ToArray();
            }
        }