bootstrap-table
bootstrap-table copied to clipboard
tableGroups is undefined when using server side pagination for group-by-v2
Hi, I have a problem with server side pagination and group-by-v2.
- This is my code:
- This is result:
- This is error:
What should I do? Thanks.
Please provide us an example using our editor.
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!
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.
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 can you provide us an example?
@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!
After some preliminary examination,
this.tableGroups
is never initialized (defined ininitSort
) hence the issue and failure to access it ininitBody
.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.
@jhparker88 can you open a PR for this? I think that's the right solution
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!