Skip to content

Commit

Permalink
debounce array data grid events
Browse files Browse the repository at this point in the history
  • Loading branch information
johnspackman committed Jun 5, 2024
1 parent 5b87157 commit f13f927
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/class/qxl/datagrid/source/ArrayDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ qx.Class.define("qxl.datagrid.source.ArrayDataSource", {
extend: qx.core.Object,
implement: [qxl.datagrid.source.IDataSource],

construct() {
super();
this.__debounceChangeSize = new qxl.datagrid.util.Debounce(() => this.fireDataEvent("changeSize", this.getSize()), 100);
},

properties: {
/**
* The columns of the data.
Expand Down Expand Up @@ -58,6 +63,8 @@ qx.Class.define("qxl.datagrid.source.ArrayDataSource", {
},

members: {
__debounceChangeSize: null,

/**
* Apply for `model`
*/
Expand All @@ -77,7 +84,7 @@ qx.Class.define("qxl.datagrid.source.ArrayDataSource", {
* @param {*} evt
*/
__onModelChange(evt) {
this.fireDataEvent("changeSize", this.getSize());
this.__debounceChangeSize.run();
},

/**
Expand Down

0 comments on commit f13f927

Please sign in to comment.