Using the below code:

// Create a model for the combo
var comboModel = qx.data.marshal.Json.createModel([]);
// Create a combo and controller using the combo model
var combo = new qx.ui.form.ComboBox();
var comboCtrl = new qx.data.controller.List(comboModel, combo);

// Create a textfield
var textf = new qx.ui.form.TextField();

// Create a model for the select
var selectModel = qx.data.marshal.Json.createModel([
  {
    label: 'Select 1', data: '1' 
  },
  {
    label: 'Select 2', data: '2'
  }
]);
// Create a selectbox and controller using the select model
var select = new qx.ui.form.SelectBox();
var selectCtrl = new qx.data.controller.List(null, select);
// Map the model to the select box
selectCtrl.setDelegate({
  bindItem: (ctrl, item, indx) =>
  {
    ctrl.bindProperty("label", "label", null, item, indx);
    ctrl.bindProperty("data", "model", null, item, indx);
  }
});
selectCtrl.setModel(selectModel);

// Create a model for the form
var formModel = qx.data.marshal.Json.createModel({
  text: null,
  combo: null,
  select: null
});
// Create a form to hold the textfield and combo
// and a controller using the form model
var form = new qx.ui.form.Form();
form.add(textf, "Text", null, 'text');
form.add(combo, "Combo", null, 'combo');
form.add(select, "Select", null, 'select');
var frmCtrl = new qx.data.controller.Form(formModel, form);

// Create a renderer for the form 
// and add the form to the window
// using a vbox layout
var rend = new qx.ui.form.renderer.Single(form);
var wnd = new qx.ui.window.Window();
wnd.setLayout(new qx.ui.layout.VBox());
wnd.add(rend);

// Show the window
wnd.show();

// Add items to the comboModel
comboModel.push('Test');
comboModel.push('Test2');

// Get the model after the user changed 
// the view, reflecting these changes
formModel.addListener('changeModel', () => {
  console.log(qx.util.Serializer.toJson(formModel));
});

I get:

024216 qx.event.Manager: There is no event handler for the event
'changeModel' on target 'qx.data.model.combo"select"text[453-0]'!
Native.js (line 59)
"changeModel|bubble|1174"

When make some changes in the view, there is no triggering of the event
handler. When I just run the console.log code, however, I get the expected
result. 



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/How-to-listen-to-model-change-tp7586702.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to