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

Grid making repetitive requests for paginated groups

7 Answers 184 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Charlie
Top achievements
Rank 1
Charlie asked on 04 Aug 2015, 08:20 PM

I would like to confirm if anybody has gotten this behavior with server grouping and virtual scroll bar enabled. 

When I used the scroll bar to drag down half the page, the grid fires off a take and skip post request to my server and gets returned some groups. But when I use the scroll bar from here, the last request two requests (and sometime other requests) get fired off consecutively without completion almost like on a infinite loop. The developer console in the browser logs an never ending repeat of two previous (or current) requests over and over again. Sometimes when sing the scroll wheel after paginating the server grouping, will trigger off a constant stream requests.

I have included my grid settings below. 

var grid = $('#kendo-table').kendoGrid({
  dataSource: {
  type: "json",
  serverPaging: true,
  serverSorting: true,
  serverFiltering: true,
  serverGrouping: true,
  pageSize: 10000,
  schema:schema,
  transport: {
    // "Posting sorting parameters to back end"
    read: {
      type: "POST",
      url: restApiHost,
      contentType: "application/json",
      beforeSend: _beforeSendXHRModifier,
      data:{
        // this is custom, it defines the raw report we show
        targetTable:targetTable
      }
    },
    parameterMap:function(data,type){
      if(type === "read"){
        // maps data to the post request, things that are mapped are like: pageSize, skip, take, ect
        console.log("paramterMap on: ");
        console.log(data);
        return kendo.stringify(data);
      }
    }
  }, 
},
  height: height,
  scrollable: {
      virtual: true
  },
  pageable:{
    refresh: true,
    previousNext: false,
    numeric:false,
    messages: {
      display: "Loaded {0}-{1} from virtualizing {2} data items"
    }
  },
  groupable: true,
  sortable: true,
  selectable:'multiple cell',
  reorderable:true,
  resizable:true,
  columns: columns,
  filterable: true,
  filterMenuInit: _onFilterMenuInit,
}).data("kendoGrid");
 
grid.bind('dataBound',function(e){
  console.log("dataBoundEvent without new grid instance");
  var gridDataSource = e.sender.dataSource;
  if (gridDataSource.group().length > 0) {
      //the grid is grouped
      $("#kendo-table").find(".k-icon.k-i-collapse").trigger("click");
      console.log('Lets start grouping, expanding will trigger ajax call on elements of this group');
  }
});

7 Answers, 1 is accepted

Sort by
0
Charlie
Top achievements
Rank 1
answered on 06 Aug 2015, 01:37 PM
Seems like an issue with loading my columns as collapsed. If the grid groups are non-collapsed then the pagination is working fine. There are too many record groups that I have and it would be nice to see the group headers only because they have some aggregate numbers on them. As soon as they are clicked, then we populate the groups asynchronously. 
0
Nikolay Rusev
Telerik team
answered on 07 Aug 2015, 11:53 AM

Hello Charlie,

 

I'm not able to replicate the described behavior on the example bellow: http://runner.telerik.io/fullscreen/@rusev/InofE

 

In case of virtual scrollable the number of requests depends on the height of the widget and pageSize. Also the DataSouce will pre-fetch some data in order to achieve more smooth scrolling.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Charlie
Top achievements
Rank 1
answered on 07 Aug 2015, 02:58 PM

Thanks for your reply Nikolay, I found that what was blocking me from the start was introducing frozen columns that are grouped on. databound's 'e' parameter doesn't recognize the table with frozen columns and thus was not collapsing the frozen columns. Therefore I had to use jQuery selectors to manually achieve that, hence creating this unexpected behavior. 

Is this a limitation of kendo grid or a bug? 

 

To Reproduce, set a column to be frozen, then group by that. 

Example here: http://dojo.telerik.com/ifaBe/2

0
Charlie
Top achievements
Rank 1
answered on 07 Aug 2015, 03:39 PM

The example above, I've discovered how to target all columns using the element attribute. 

In the case where page size was 100, then a particular group was 200 rows in length, viewing page 1 of the collapsed row yields 1 group. The scroll bar doesn't adjust to the amount of collapsed rows and still has anchor points at the same locations (for requesting another page) as if the groups are all expanded. In my head, this was by design and cannot be used that way but  I was wondering if you had any ideas to get around this. 

My data sometimes will have about 80k+ unique elements within a group. Could there be a way to load a table when expanding the row of grouping? 

The type of pagination that is suitable would be paginating the number of groups not actually the elements itself as those are loaded after we expand a group. I've taken a look at some group hierarchy templates but I don't know how to initialize them from expanding a group. 

0
Nikolay Rusev
Telerik team
answered on 10 Aug 2015, 02:39 PM

Hello Charlie,

 

When frozen columns are used the widget is rendered in two separated tables - one for locked columns - lockedTable, and one for the non-locked columns - table. That said the behavior which you are describing is expected.

 

Regarding your second post - I'm not quite sure how to replicate this. Can you please capture a small screen case, using one of the examples in this thread, demonstrating the behavior?

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Charlie
Top achievements
Rank 1
answered on 10 Aug 2015, 06:57 PM
Here I have a pic showing the same page getting requested. The requests fire back and forth between page 2 and 3 for the amount of movement in the scroll bar. 
0
Nikolay Rusev
Telerik team
answered on 12 Aug 2015, 11:59 AM

Hello Charlie,

I'm still not able to replicate this behavior locally. However the screen-shot makes me thing that you are implementing some kind of load on demand for the group items which is not supported by the widget. Am I correct? 

You can read on some of the limitation and how it works for Grid virtual scrolling here - Scrolling.

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Charlie
Top achievements
Rank 1
Answers by
Charlie
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or