Skip to content

Commit

Permalink
Add update for refresh datatable field of click datatable refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
mduvernon committed Nov 20, 2023
1 parent 67971a7 commit eaba209
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ include ../../../../../../views/mixins/loading.pug
:table_is_busy="is_busy"
:editable="false"
:explicit_html="column.explicit_html"
:refresh="refresh_column_field"
)

template(v-else)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export default class TableWidgetTableComponent extends VueComponentBase {
private throttle_update_visible_options = debounce(this.throttled_update_visible_options.bind(this), 500);
private throttle_do_update_visible_options = debounce(this.throttled_do_update_visible_options.bind(this), 500);
private debounced_onchange_dashboard_vo_route_param = debounce(this.onchange_dashboard_vo_route_param, 100);
private debounced_reset_refresh_column_field = debounce(this.throttled_reset_refresh_column_field, 1000);

private pagination_count: number = 0;
private pagination_offset: number = 0;
Expand Down Expand Up @@ -173,6 +174,8 @@ export default class TableWidgetTableComponent extends VueComponentBase {

private show_export_alert: boolean = false;

private refresh_column_field: boolean = false;

get all_page_widget_by_id(): { [id: number]: DashboardPageWidgetVO } {
return VOsTypesManager.vosArray_to_vosByIds(this.all_page_widget);
}
Expand Down Expand Up @@ -1693,6 +1696,18 @@ export default class TableWidgetTableComponent extends VueComponentBase {
AjaxCacheClientController.getInstance().invalidateUsingURLRegexp(new RegExp('.*' + ModuleContextFilter.APINAME_select_datatable_rows));
AjaxCacheClientController.getInstance().invalidateUsingURLRegexp(new RegExp('.*' + ModuleContextFilter.APINAME_select_count));
await this.throttle_do_update_visible_options();

this.on_refresh();
}

private on_refresh() {
this.refresh_column_field = true;

this.debounced_reset_refresh_column_field();
}

private throttled_reset_refresh_column_field() {
this.refresh_column_field = false;
}

@Watch('widget_options', { immediate: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
:param="vo[field.parameter_datatable_field_uid]"
:param_ref_id="vo[field.parameter_datatable_field_uid + '___id___']"
:dashboard_page="dashboard_page"
:refresh="refresh"
)

template(v-else-if="field.type == 'FILE'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ export default class DatatableComponentField extends VueComponentBase {
@Prop({ default: false })
private editable: boolean;

@Prop({ default: false })
private refresh: boolean; // trigger that should force a refresh of the field

@Prop({ default: null })
private filter_additional_params: any[];

Expand Down

0 comments on commit eaba209

Please sign in to comment.