在 setModel 之后不会触发 changeBubble 事件。在 createModel(true) 之后它可以工作。是否有另一种方法可以知道表格上的某些内容发生了变化?
var page = new qx.ui.mobile.page.NavigationPage();
page.setTitle("Login");
page.addListener("initialize", function() {
var form = new qx.ui.mobile.form.Form();
// User name
var user = new qx.ui.mobile.form.TextField();
user.setRequired(true);
form.add(user, "Username");
var controller = new qx.data.controller.Form(null, form);
//var model = controller.createModel(true); This works
var data = {
"username": "Martin"
};
var model = qx.data.marshal.Json.createModel(data);
controller.setModel(model);
model.addListener("changeBubble", function (qxEvent) {
alert("Changed username");
}, this);
// Use form renderer
page.getContent().add(new qx.ui.mobile.form.renderer.Single(form));
},this);
this.getManager().addDetail(page);
page.show();