Fix AG Grid restored grouping values
This commit is contained in:
40
dist/tryton-sao.js
vendored
40
dist/tryton-sao.js
vendored
@@ -23284,6 +23284,30 @@ function eval_pyson(value){
|
|||||||
var text = this._get_column_text_value(column, record);
|
var text = this._get_column_text_value(column, record);
|
||||||
return text || Sao.i18n.gettext('(Empty)');
|
return text || Sao.i18n.gettext('(Empty)');
|
||||||
},
|
},
|
||||||
|
_load_grouping_values: function() {
|
||||||
|
if (!this._is_grouping_active()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var grouping = this._get_grouping_state();
|
||||||
|
var promises = [];
|
||||||
|
grouping.groupBy.forEach(name => {
|
||||||
|
this.group.forEach(record => {
|
||||||
|
if (record && !record.is_loaded(name)) {
|
||||||
|
promises.push(record.load(name, true, false));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (!promises.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
console.log('[AGGRID][GROUPING_LOAD_FIELDS_FLAT_JSON]',
|
||||||
|
JSON.stringify({
|
||||||
|
viewId: this.view_id,
|
||||||
|
groupBy: grouping.groupBy,
|
||||||
|
pendingLoads: promises.length,
|
||||||
|
}));
|
||||||
|
return jQuery.when.apply(jQuery, promises);
|
||||||
|
},
|
||||||
_get_column_raw_value: function(column, record) {
|
_get_column_raw_value: function(column, record) {
|
||||||
if (!column || !record || !column.attributes || !column.attributes.name) {
|
if (!column || !record || !column.attributes || !column.attributes.name) {
|
||||||
return null;
|
return null;
|
||||||
@@ -23529,6 +23553,18 @@ function eval_pyson(value){
|
|||||||
}
|
}
|
||||||
bucket.records.push(record);
|
bucket.records.push(record);
|
||||||
});
|
});
|
||||||
|
if (window.console && level === 0) {
|
||||||
|
console.log('[AGGRID][GROUPING_KEYS_FLAT_JSON]',
|
||||||
|
JSON.stringify({
|
||||||
|
viewId: this.view_id,
|
||||||
|
column: column_name,
|
||||||
|
groupCount: groups.length,
|
||||||
|
groups: groups.slice(0, 12).map(group => ({
|
||||||
|
key: group.key,
|
||||||
|
count: group.records.length,
|
||||||
|
})),
|
||||||
|
}));
|
||||||
|
}
|
||||||
groups.forEach(group => {
|
groups.forEach(group => {
|
||||||
var group_path = path.concat([column_name + ':' + group.key]);
|
var group_path = path.concat([column_name + ':' + group.key]);
|
||||||
var is_expanded = grouping.expandAll ||
|
var is_expanded = grouping.expandAll ||
|
||||||
@@ -24194,6 +24230,10 @@ function eval_pyson(value){
|
|||||||
if (!this.gridApi) {
|
if (!this.gridApi) {
|
||||||
return jQuery.when();
|
return jQuery.when();
|
||||||
}
|
}
|
||||||
|
var grouping_load = this._load_grouping_values();
|
||||||
|
if (grouping_load) {
|
||||||
|
return grouping_load.then(() => this.display(selected));
|
||||||
|
}
|
||||||
this._grid_columns = this._build_column_defs();
|
this._grid_columns = this._build_column_defs();
|
||||||
var row_data = this._get_row_data();
|
var row_data = this._get_row_data();
|
||||||
console.log('[AGGRID][ROW_DATA_KIND_FLAT_JSON]', JSON.stringify({
|
console.log('[AGGRID][ROW_DATA_KIND_FLAT_JSON]', JSON.stringify({
|
||||||
|
|||||||
@@ -23284,6 +23284,30 @@ function eval_pyson(value){
|
|||||||
var text = this._get_column_text_value(column, record);
|
var text = this._get_column_text_value(column, record);
|
||||||
return text || Sao.i18n.gettext('(Empty)');
|
return text || Sao.i18n.gettext('(Empty)');
|
||||||
},
|
},
|
||||||
|
_load_grouping_values: function() {
|
||||||
|
if (!this._is_grouping_active()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var grouping = this._get_grouping_state();
|
||||||
|
var promises = [];
|
||||||
|
grouping.groupBy.forEach(name => {
|
||||||
|
this.group.forEach(record => {
|
||||||
|
if (record && !record.is_loaded(name)) {
|
||||||
|
promises.push(record.load(name, true, false));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (!promises.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
console.log('[AGGRID][GROUPING_LOAD_FIELDS_FLAT_JSON]',
|
||||||
|
JSON.stringify({
|
||||||
|
viewId: this.view_id,
|
||||||
|
groupBy: grouping.groupBy,
|
||||||
|
pendingLoads: promises.length,
|
||||||
|
}));
|
||||||
|
return jQuery.when.apply(jQuery, promises);
|
||||||
|
},
|
||||||
_get_column_raw_value: function(column, record) {
|
_get_column_raw_value: function(column, record) {
|
||||||
if (!column || !record || !column.attributes || !column.attributes.name) {
|
if (!column || !record || !column.attributes || !column.attributes.name) {
|
||||||
return null;
|
return null;
|
||||||
@@ -23529,6 +23553,18 @@ function eval_pyson(value){
|
|||||||
}
|
}
|
||||||
bucket.records.push(record);
|
bucket.records.push(record);
|
||||||
});
|
});
|
||||||
|
if (window.console && level === 0) {
|
||||||
|
console.log('[AGGRID][GROUPING_KEYS_FLAT_JSON]',
|
||||||
|
JSON.stringify({
|
||||||
|
viewId: this.view_id,
|
||||||
|
column: column_name,
|
||||||
|
groupCount: groups.length,
|
||||||
|
groups: groups.slice(0, 12).map(group => ({
|
||||||
|
key: group.key,
|
||||||
|
count: group.records.length,
|
||||||
|
})),
|
||||||
|
}));
|
||||||
|
}
|
||||||
groups.forEach(group => {
|
groups.forEach(group => {
|
||||||
var group_path = path.concat([column_name + ':' + group.key]);
|
var group_path = path.concat([column_name + ':' + group.key]);
|
||||||
var is_expanded = grouping.expandAll ||
|
var is_expanded = grouping.expandAll ||
|
||||||
@@ -24194,6 +24230,10 @@ function eval_pyson(value){
|
|||||||
if (!this.gridApi) {
|
if (!this.gridApi) {
|
||||||
return jQuery.when();
|
return jQuery.when();
|
||||||
}
|
}
|
||||||
|
var grouping_load = this._load_grouping_values();
|
||||||
|
if (grouping_load) {
|
||||||
|
return grouping_load.then(() => this.display(selected));
|
||||||
|
}
|
||||||
this._grid_columns = this._build_column_defs();
|
this._grid_columns = this._build_column_defs();
|
||||||
var row_data = this._get_row_data();
|
var row_data = this._get_row_data();
|
||||||
console.log('[AGGRID][ROW_DATA_KIND_FLAT_JSON]', JSON.stringify({
|
console.log('[AGGRID][ROW_DATA_KIND_FLAT_JSON]', JSON.stringify({
|
||||||
|
|||||||
Reference in New Issue
Block a user