Hi Isomorphic,
my main ListGrid in my application is showing data grouped. Because of groupByMaxRecords this can't happen all the time.
I'm pretty sure there is no declarative way of "keeping a ListGrid grouped if possible". I came up with this programmatic solution but am not sure if it is correct. Can you add your two cents?
See this modified sample (v12.0p_2022-03-31) and change the filter from "XD" to "D".
I'm seeing two requests on the described refilter for "D" (expected) and twice this log line:
I'm not sure the line should be there twice, because the 2nd request is because we are already trying to group - so I kinda expect to return this.isGrouped to return true for the 2nd request. Is this a problem?
Could you a add declarative way with a new property like "alwaysTryToGroupBy" to your enhancement list?
Thank you & Best regards
Blama
my main ListGrid in my application is showing data grouped. Because of groupByMaxRecords this can't happen all the time.
I'm pretty sure there is no declarative way of "keeping a ListGrid grouped if possible". I came up with this programmatic solution but am not sure if it is correct. Can you add your two cents?
See this modified sample (v12.0p_2022-03-31) and change the filter from "XD" to "D".
Code:
isc.ListGrid.create({ ID: "dsListGrid", width: "100%", height: "100%", autoFetchData: true, dataSource: "supplyItem", showFilterEditor: true, initialCriteria: { _constructor: "AdvancedCriteria", operator: "and", criteria: [{ fieldName: "itemName", operator: "lessThan", value: "XD" }, ] }, groupByField: "units", groupByComplete: function(fields) { if (fields == null || fields.length == 0) { isc.logWarn('Not grouped'); this.showField("units"); this.getFieldByName("units").canHide = true; isc.say("Can't group"); } else { isc.logWarn('Grouped by: ' + fields) this.hideField("units"); this.getFieldByName("units").canHide = false; } }, dataArrived: function(startRow, endRow) { if (!this.isGrouped && (this.getGroupByFields() == null || this.getGroupByFields().length == 0) && this.data.lengthIsKnown() && this.data.getLength() <= this.groupByMaxRecords) { isc.logWarn('Grouping by units, as data length (' + this.data.getLength() + ') is below groupByMaxRecords'); this.groupBy("units"); } } });
Grouping by units, as data length (839) is below groupByMaxRecords
Grouping by units, as data length (839) is below groupByMaxRecords
Grouping by units, as data length (839) is below groupByMaxRecords
Could you a add declarative way with a new property like "alwaysTryToGroupBy" to your enhancement list?
Thank you & Best regards
Blama
Comment