Esempio n. 1
0
        public void gotoLast(jQueryEvent e)
        {
            NavigationState state = getNavState();

            if (state.CanGotoLast)
            {
                PagingInfo paging = new PagingInfo();
                paging.PageNum = state.pagingInfo.TotalPages - 1;
                _dataView.SetPagingOptions(paging);
            }
        }
Esempio n. 2
0
        public void gotoNext(jQueryEvent e)
        {
            NavigationState state = getNavState();

            if (state.CanGotoNext)
            {
                PagingInfo paging = new PagingInfo();
                paging.PageNum = state.pagingInfo.PageNum + 1;
                _dataView.SetPagingOptions(paging);
                // #71 Move scroll bar to the top
                Script.Literal("{0}.scrollRowToTop(0)", _grid);
            }
        }
Esempio n. 3
0
 public NavigationState getNavState()
 {
     bool cannotLeaveEditMode = (bool)Script.Literal("!Slick.GlobalEditorLock.commitCurrentEdit()");
     PagingInfo pagingInfo = _dataView.GetPagingInfo();
     int? lastPage = pagingInfo.TotalPages - 1;
     NavigationState info = new NavigationState();
     info.CanGotoFirst = !cannotLeaveEditMode && pagingInfo.PageSize != 0 && pagingInfo.PageNum > 0;
     info.CanGotoLast = !cannotLeaveEditMode && pagingInfo.PageSize != 0 && pagingInfo.PageNum != lastPage;
     info.CanGotoPrev = !cannotLeaveEditMode && pagingInfo.PageSize != 0 && pagingInfo.PageNum > 0;
     info.CanGotoNext = !cannotLeaveEditMode && pagingInfo.PageSize != 0 && pagingInfo.PageNum < lastPage;
     info.pagingInfo = pagingInfo;
     return info;
 }
Esempio n. 4
0
        public NavigationState getNavState()
        {
            bool            cannotLeaveEditMode = (bool)Script.Literal("!Slick.GlobalEditorLock.commitCurrentEdit()");
            PagingInfo      pagingInfo          = _dataView.GetPagingInfo();
            int?            lastPage            = pagingInfo.TotalPages - 1;
            NavigationState info = new NavigationState();

            info.CanGotoFirst = !cannotLeaveEditMode && pagingInfo.PageSize != 0 && pagingInfo.PageNum > 0;
            info.CanGotoLast  = !cannotLeaveEditMode && pagingInfo.PageSize != 0 && pagingInfo.PageNum != lastPage;
            info.CanGotoPrev  = !cannotLeaveEditMode && pagingInfo.PageSize != 0 && pagingInfo.PageNum > 0;
            info.CanGotoNext  = !cannotLeaveEditMode && pagingInfo.PageSize != 0 && pagingInfo.PageNum < lastPage;
            info.pagingInfo   = pagingInfo;
            return(info);
        }
Esempio n. 5
0
        public void updatePager(PagingInfo pagingInfo)
        {
            NavigationState state = getNavState();

            jQueryObject firstButton = _container.Find(".sparkle-grid-paging-first");
            jQueryObject backButton  = _container.Find(".sparkle-grid-paging-back");
            jQueryObject nextButton  = _container.Find(".sparkle-grid-paging-next");
            jQueryObject label       = _container.Find(".sparkle-grid-status-label");
            jQueryObject pageInfo    = _container.Find(".sparkle-grid-status-paging-page");
            jQueryObject status      = _container.Find(".sparkle-grid-status-label");

            if (state.CanGotoFirst)
            {
                firstButton.RemoveClass("disabled");
            }
            else
            {
                firstButton.AddClass("disabled");
            }

            if (state.CanGotoPrev)
            {
                backButton.RemoveClass("disabled");
            }
            else
            {
                backButton.AddClass("disabled");
            }

            if (state.CanGotoNext)
            {
                nextButton.RemoveClass("disabled");
            }
            else
            {
                nextButton.AddClass("disabled");
            }

            status.Text(string.Format("{0} - {1} of {2} ({3} selected)", pagingInfo.FromRecord, pagingInfo.ToRecord, pagingInfo.TotalRows, _dataView.GetSelectedRows().Length.ToString()));
            pageInfo.Text(string.Format("Page {0}", pagingInfo.PageNum + 1));
        }