Skip to content

Commit

Permalink
Merge commit '33a3980db21b394b5f2d4b90b052383e7d947656'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnspackman committed Jan 23, 2024
2 parents 7316b7d + 33a3980 commit c9a59ba
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions source/class/qxl/datagrid/source/ArrayDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ qx.Class.define("qxl.datagrid.source.ArrayDataSource", {
}
if (value) {
value.addListener("change", this.__onModelChange, this);
this.__onModelChange();
}
},

Expand Down
13 changes: 7 additions & 6 deletions source/class/qxl/datagrid/ui/WidgetPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ qx.Class.define("qxl.datagrid.ui.WidgetPane", {
this.setDataSource(dataSource);
}
this._setLayout(new qxl.datagrid.ui.layout.Fixed());
this.addListener("tap", this.__onTap, this);
this.addListener("tap", this.__onTap, this, true);
},

properties: {
Expand Down Expand Up @@ -216,13 +216,14 @@ qx.Class.define("qxl.datagrid.ui.WidgetPane", {
*/
__onTap(evt) {
let widget = qx.ui.core.Widget.getWidgetByElement(evt.getOriginalTarget());
while (widget && widget.isAnonymous()) {
let model = null;
while (widget && widget != this && !model) {
model = this.__widgetFactory.getModelForWidget(widget);
if (model) {
break;
}
widget = widget.getLayoutParent();
}
if (!widget) {
return;
}
let model = this.__widgetFactory.getModelForWidget(widget);
if (!model) {
return;
}
Expand Down
16 changes: 16 additions & 0 deletions source/class/qxl/datagrid/ui/factory/SimpleWidgetFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@
qx.Class.define("qxl.datagrid.ui.factory.SimpleWidgetFactory", {
extend: qxl.datagrid.ui.factory.AbstractWidgetFactory,

events: {
/**
* @typedef BindWidgetData
* @property {qx.ui.core.Widget} widget the wiget to bind
* @property {qx.core.Object} model the model the widget is bound to
*
* Fired when a widget is bound; data is {BindWidgetData} */
"bindWidget": "qx.event.type.Data",

/** Fired when a widget is unbound; data is {BindWidgetData} */
"unbindWidget": "qx.event.type.Data"
},

members: {
/**
* @override
Expand All @@ -34,6 +47,7 @@ qx.Class.define("qxl.datagrid.ui.factory.SimpleWidgetFactory", {
let bindingData = widget.getUserData("qxl.datagrid.factory.AbstractWidgetFactory.bindingData");
bindingData.binding = bindingData.column.bindWidget(widget, model, this);
bindingData.model = model;
this.fireDataEvent("bindWidget", { widget, model });
},

/**
Expand All @@ -44,8 +58,10 @@ qx.Class.define("qxl.datagrid.ui.factory.SimpleWidgetFactory", {
if (bindingData.binding) {
bindingData.binding.dispose();
}
let model = bindingData.model;
bindingData.model = null;
bindingData.binding = null;
this.fireDataEvent("unbindWidget", { widget, model });
},

/**
Expand Down

0 comments on commit c9a59ba

Please sign in to comment.