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

UseAllDataFields paging and grouping: Results on first page only

6 Answers 141 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Blair
Top achievements
Rank 1
Blair asked on 25 Apr 2014, 08:32 PM
Hi,

The project I've taken over uses all code behind for creating a grid. The solution calls for using column aggregates. According to other Telerik threads I found that I needed to set UseAllDataFields = true. Upon implementing this I noticed that grouping and paging did not work correctly. The problem is you only get the first page of results. Once you select another page, no records are returned. Filtering does not seem to be affected by this.

Unfortunately, I cannot post all the code (to spread out). However, here are the grid properties:

RadGrid1.MasterTableView.EditFormSettings.EditColumn.ButtonType = GridButtonColumnType.PushButton;
 
            RadGrid1.MasterTableView.UseAllDataFields = true;
             
            RadGrid1.EnableViewState = true;
            RadGrid1.EnableLinqExpressions = false;
            RadGrid1.AutoGenerateColumns = false;
            RadGrid1.MasterTableView.EnableColumnsViewState = false;         // because the column structure can change on Postback (new Layout)
 
            RadGrid1.ClientSettings.ClientEvents.OnGridCreated = "onGridCreated";
            RadGrid1.ClientSettings.ClientEvents.OnCommand = "onGridCommand";           
            RadGrid1.ClientSettings.ClientEvents.OnColumnResized = "OnGridColumnResized";
            RadGrid1.ClientSettings.ClientEvents.OnColumnSwapped = "OnColumnSwapped";
            RadGrid1.ClientSettings.ClientEvents.OnRowMouseOver = "RowMouseOver";
            RadGrid1.ClientSettings.ClientEvents.OnFilterMenuShowing = "filterMenuShowing";
            RadGrid1.FilterMenu.OnClientShowing = "MenuShowing";
 
 
            RadGrid1.CellSpacing = 2;
            RadGrid1.ShowStatusBar = false;
            RadGrid1.MasterTableView.TableLayout = GridTableLayout.Fixed;
 
            RadGrid1.EnableHeaderContextMenu = true;
 
            RadGrid1.MasterTableView.EditMode = GridEditMode.EditForms;
            RadGrid1.MasterTableView.EditFormSettings.FormStyle.BackColor =      System.Drawing.ColorTranslator.FromHtml("#FFFFDD");
 
 
            RadGrid1.GroupingSettings.ShowUnGroupButton = true;            
            RadGrid1.ClientSettings.AllowDragToGroup = true;
            RadGrid1.ClientSettings.AllowGroupExpandCollapse = true;       
            RadGrid1.MasterTableView.GroupLoadMode = GridGroupLoadMode.Client;      
 
            RadGrid1.GroupingSettings.CaseSensitive = false;           
            RadGrid1.FilterItemStyle.Wrap = false;
 
            RadGrid1.AllowSorting = true;
            RadGrid1.MasterTableView.AllowNaturalSort = false;
            RadGrid1.AllowPaging = true;
            RadGrid1.MasterTableView.PagerStyle.AlwaysVisible = true;
 
 
            RadGrid1.ClientSettings.Scrolling.AllowScroll = true;
            RadGrid1.ClientSettings.Scrolling.UseStaticHeaders = true;
            RadGrid1.ClientSettings.Scrolling.SaveScrollPosition = true;
 
            RadGrid1.ClientSettings.Resizing.AllowColumnResize = true;
            RadGrid1.ClientSettings.Resizing.ClipCellContentOnResize = false;
            RadGrid1.ClientSettings.Resizing.EnableRealTimeResize = false;
            RadGrid1.ClientSettings.Resizing.ResizeGridOnColumnResize = true;
 
            RadGrid1.ClientSettings.AllowColumnsReorder = true;
            RadGrid1.ClientSettings.ColumnsReorderMethod = GridClientSettings.GridColumnsReorderMethod.Reorder;
            RadGrid1.ClientSettings.ReorderColumnsOnClient = false;           
 
            RadGrid1.ClientSettings.EnableRowHoverStyle = true;
            RadGrid1.ClientSettings.Selecting.AllowRowSelect = true;


Any help would be appreciated. 

Thanks.

Blair

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Apr 2014, 04:42 AM
Hi Blair,

Please try setting EnableLinqGrouping="false" for your grid.

C#:
RadGrid1.MasterTableView.EnableLinqGrouping = false;

Thanks,
Princy
0
Blair
Top achievements
Rank 1
answered on 28 Apr 2014, 11:41 AM
Thanks Princy for the quick response. Unfortunately that didn't work. Thanks.
0
Blair
Top achievements
Rank 1
answered on 28 Apr 2014, 12:04 PM
Just FYI: The grid is created and loaded in the Page_PreLoad event. 
0
Princy
Top achievements
Rank 2
answered on 29 Apr 2014, 05:25 AM
Hi Blair,

I tried a similar scenario as to yours, and I had received the same issue at my end. I was able to resolve it by setting  EnableLinqExpressions = true. Please set this property to true in your code and check if the issue is resolved. Also note that when generating a RadGrid instance entirely in code, you should use the Page_Init or Page_Load event handlers.
When creating a RadGrid on a Page_Load event, the columns or detail tables should be added to the corresponding collection first and then values for the properties of this instance should be set.
When generating a grid in the Page_Init event handler, grid columns should be added to the Columns collection of the MasterTableView after their attributes are set. No ViewState is required for grid structure to be persisted as it is recreated on each page initialization.

Please make the necessary changes and let me know if any concerns.
Thanks,
Princy
0
Blair
Top achievements
Rank 1
answered on 29 Apr 2014, 11:12 AM
Thanks Princy for doing some research. 

This sounds like a bug if you have to enable Linq expressions to make it work. When I enable it I get some other error.

As for the event placement, I believe many years back it was determined that because we persist grid state and column definitions can be changed by the users that placing it in PreLoad works best for us. We haven't had any problems for years, until this.

Thanks again for your help.
0
Pavlina
Telerik team
answered on 30 Apr 2014, 05:04 PM
Hello,

Indeed the described problem with grouping and paging can be observed. I logged it in our ideas and feedback portal where you can follow its status:
http://feedback.telerik.com/Project/108/Feedback/Details/127261-usealldatafields-paging-and-grouping-results-on-first-page-only

Please excuse us for the inconvenience caused.

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Blair
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Blair
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or