This is a migrated thread and some comments may be shown as answers.

Page on Scroll work with Scrollable.Height set to AUTO

5 Answers 304 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Richard
Top achievements
Rank 1
Richard asked on 31 Jul 2012, 04:01 AM

Hi Guys,

Just ran into an issue that if I make my grid page by scroll like below 

.Pageable(paging => paging.Style(GridPagerStyles.Status).PageOnScroll(true)

and specifying the action method. It works fine, but when I try to make the grid height "auto", like below 

.Scrollable(scrolling => scrolling.Height("auto"))

then the no matter how you scroll the grid, it does not jump to the next page. As the grid itself does not contain an scroll bar vertically.

This even does not work with the number set to any values like below.

 .Scrollable(scrolling => scrolling.Height("500")) 

Could anyone help me out?

thanks,

Richard

5 Answers, 1 is accepted

Sort by
0
Deise
Top achievements
Rank 1
answered on 31 Jul 2012, 02:55 PM
Hi;
I have a similar grid and it jump to the next page using jquery.
Take a look: 
.Pageable(paging => paging
.Style(GridPagerStyles.NextPreviousAndNumeric)
.Position(GridPagerPosition.Bottom)
.PageSize(20)
.PageOnScroll(true))
.ClientEvents(events => events.OnDataBinding("OnDataBinding"))
.Scrollable(scrool => scrool.Height(380).Enabled(true))
.TableHtmlAttributes(new { style = "width:auto" })

//Jquery event
function OnDataBinding(e) {
    e.data = $.extend({}, e.data);
}
If you put a string int the 'scrool.Height', your grid will ajust automatically. If you put a int number the grid's height will be fixed.
My grid is working very weel...
0
Richard
Top achievements
Rank 1
answered on 01 Aug 2012, 03:47 AM

Deise,

Thanks so much for the answer! 

However, I don't quite understand how your Jquery ondatabinding event gonna work. It seems when I set the Scroll.Height to AUTO, there would be no scroll bar available on the page. So it's really not possible to trigger the onScroll event when scrolling the mouse wheel... and the paging's simply not working in that case. 

thanks,

Richard

0
Deise
Top achievements
Rank 1
answered on 01 Aug 2012, 01:02 PM
Hi Richard;
You are right, is not necessary to use the jquery function.
I did a grid similar this Demo and it works exactly same! This is my grid:
@(Html.Telerik().Grid(Model.grid)
        .Name("GridGrupo")
        .DataKeys(keys =>
        {
            keys.Add(p => p.Id);
        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Ajax().Select("Grid", "Grupo");
 
        })
        .Columns(columns =>
        {
            columns.Bound(p => p.Id).Hidden(true).IncludeInContextMenu(false);
            columns.Bound(p => p.Descricao).Width(500).Title("Descrição");
        })
        .ClientEvents(events => events.OnRowSelect("onRowSelected"))
        .Sortable(sorting => sorting.SortMode(GridSortMode.SingleColumn))
        .Pageable(paging => paging.Style(GridPagerStyles.Status).PageOnScroll(true))
        .Filterable()
        .Selectable()
        )
In this case is not necessary to define a height of the grid.
The property PageOnScroll define if you have lots of records, when you scrolling the page the records are showing. If you define the height of the grid, when you add a record your grid will adjust automatically and the "PageOnScroll" will not work.
I did two samples: with Scroll.Height and not with it. Take a look the attachments.
In the "GridWithScrollHeight" sample I used "Scrollable(scrool => scrool.Height("auto").Enabled(true))" and in the second sample I didn't use this.

Best Regards.
0
Richard
Top achievements
Rank 1
answered on 01 Aug 2012, 11:45 PM

Yes, I would say Auto height(Height set to auto) works together with PageSize. Whenever auto height is enabled, it limits the page height to the pagesize  you set to and never let PageOnScroll happen. So in this case, this is still a issue that Telerik team need to look after...

In another hand, even we could set the height to enable PageOnScroll, but still, the height is something from our guess.

I will write to Telerik to get some response on it.

thanks,

Richard

0
Deise
Top achievements
Rank 1
answered on 02 Aug 2012, 01:43 AM
Good luck Richard!
If you get some answer from Telerik please tell me....I have lots of problems with this control...G
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Deise
Top achievements
Rank 1
Richard
Top achievements
Rank 1
Share this question
or