bootstrap-table icon indicating copy to clipboard operation
bootstrap-table copied to clipboard

tableGroups is undefined when using server side pagination for group-by-v2

Open hteht opened this issue 3 years ago • 9 comments

Hi, I have a problem with server side pagination and group-by-v2.

  • This is my code: image
  • This is result: image
  • This is error: image What should I do? Thanks.

hteht avatar Sep 28 '21 10:09 hteht

Please provide us an example using our editor.

UtechtDustin avatar Oct 01 '21 18:10 UtechtDustin

I'm going to close this issue, because we got no response and no example from you within 7days. If you still need help plesae provide us an example!

UtechtDustin avatar Oct 10 '21 19:10 UtechtDustin

I'm having the same issue when:

  data-group-by="true"
  data-group-by-field="name"

is used together with:

data-url="..."
data-side-pagination="server"

If you still need help plesae provide us an example!

Well, this should do it https://live.bootstrap-table.com/code/jhparker88/9340 as it clearly shows the error.

image

jhparker88 avatar Oct 21 '21 19:10 jhparker88

After some preliminary examination, this.tableGroups is never initialized (defined in initSort) hence the issue and failure to access it in initBody.

I just added the following snippet to initBody and it seems to resolve the issue since it now works as it suppose to be.

@@ -1400,10 +1400,12 @@
 
     for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
       args[_key2] = arguments[_key2];
     }
 
+    this.initSort();
+
     _initBody.apply(this, Array.prototype.slice.apply(args));
 
     if (this.options.groupBy && this.options.groupByField !== '') {
       var that = this;
       var checkBox = false;

jhparker88 avatar Oct 21 '21 22:10 jhparker88

@jhparker88 can you provide us an example?

djhvscf avatar Oct 22 '21 21:10 djhvscf

@jhparker88 can you provide us an example?

What do you mean by that? An example is provided above that clearly shows the error in the editor!

jhparker88 avatar Oct 22 '21 22:10 jhparker88

After some preliminary examination, this.tableGroups is never initialized (defined in initSort) hence the issue and failure to access it in initBody.

I just added the following snippet to initBody and it seems to resolve the issue since it now works as it suppose to be.

@@ -1400,10 +1400,12 @@
 
     for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
       args[_key2] = arguments[_key2];
     }
 
+    this.initSort();
+
     _initBody.apply(this, Array.prototype.slice.apply(args));
 
     if (this.options.groupBy && this.options.groupByField !== '') {
       var that = this;
       var checkBox = false;

I tried your method and it was successful. Thank you for your assistance, jhparker88. However, I'm interested in the vendor's reaction. Thanks.

hteht avatar Oct 28 '21 08:10 hteht

@jhparker88 can you open a PR for this? I think that's the right solution

djhvscf avatar Oct 29 '21 22:10 djhvscf

I'm having exact the same problem using server side processing along with group by v2. Hope to see the PR getting merged in the coming update. Keep up the good work guys!

DataSupplier avatar Dec 26 '22 07:12 DataSupplier