Example #1
0
        /// <summary>
        /// Handles the OnDemandDataSourceLoad event of the dataPager control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Syncfusion.Windows.Controls.Grid.GridDataOnDemandPageLoadingEventArgs"/> instance containing the event data.</param>
        private async void dataPager_OnDemandDataSourceLoad(object sender, GridDataOnDemandPageLoadingEventArgs e)
        {
            DataPagerExt ex          = e.Source as DataPagerExt;
            ViewModel    dataContext = this.AssociatedObject.DataContext as ViewModel;
            bool         IsCache     = false;

            //Assigning number of rows to be fetched from HBase
            HBaseOperation.FetchSize = 5000;

            if (!dataContext.ResultCollection.ContainsKey(ex.PageIndex) && HBaseOperation.HasRows)
            {
                dataContext.OrderDetails = await HBaseOperation.ScanTableAsync(dataContext.TableName, dataContext.Connection);

                dataContext.ResultCollection.Add(ex.PageIndex == -1 ? 1 : ex.PageIndex, dataContext.OrderDetails);
                IsCache = false;
            }
            else
            {
                dataContext.OrderDetails = dataContext.ResultCollection[ex.PageIndex];
                IsCache = true;
            }

            bool IsPrevious = PreviousPageIndex > ex.PageIndex;

            if (!IsPrevious && HBaseOperation.HasRows && !IsCache)
            {
                if (ex.PageIndex != -1)
                {
                    ex.PageCount = ex.PageCount + 1;
                }
            }

            PreviousPageIndex = ex.PageIndex == -1 ? 1 : ex.PageIndex;
        }
Example #2
0
        /// <summary>
        /// Wires the paging helper with GridGroupingControl.
        /// </summary>
        /// <param name="groupingGrid">GridGroupingControl</param>
        /// <param name="table">DataTable</param>
        public async void Wire(GridGroupingControl groupingGrid, String tableName, HBaseConnection con, Panel loaderPic)
        {
            commonLoaderPic = loaderPic;
            _grid           = groupingGrid;
            this.tableName  = tableName;
            this.con        = con;
            ResultSet       = await HBaseOperation.ScanTableAsync(tableName, con);

            InitializePager();
        }
Example #3
0
        //<summary>
        //A method that was invoked on clicking arrow buttons in pager control.
        //</summary>
        //<param name="sender">The source of the event.</param>
        //<param name="e">An <see cref="T:Syncfusion.Windows.Forms.ArrowButtonEventArgs">ArrowButtonEventArgs</see> that contains the event data.</param>
        async void RecordNavigationBar_ArrowButtonClicked(object sender, ArrowButtonEventArgs e)
        {
            switch (e.Arrow)
            {
            case ArrowType.Previous:

                _currentPage -= 1;
                if (resultCollection.ContainsKey(_currentPage))
                {
                    ResultSet = resultCollection[_currentPage];
                }
                FillPage(ResultSet);
                break;

            case ArrowType.Next:
            {
                _currentPage += 1;
                if (!HBaseOperation.HasRows && !resultCollection.ContainsKey(_currentPage))
                {
                    _currentPage -= 1;
                }
                else if (resultCollection.ContainsKey(_currentPage))
                {
                    ResultSet = resultCollection[_currentPage];
                }
                else
                {
                    if (HBaseOperation.HasRows)
                    {
                        _grid.Enabled            = false;
                        commonLoaderPic.Visible  = true;
                        HBaseOperation.FetchSize = 5000;
                        ResultSet = await HBaseOperation.ScanTableAsync(tableName, con);

                        commonLoaderPic.Visible = false;
                        _grid.Enabled           = true;
                    }
                }

                FillPage(ResultSet);
                DisplayPageInfo();
            }
            break;
            }
        }