来自不同 qooxdoo 类的双向绑定

发布于 2025-01-06 17:49:18 字数 694 浏览 1 评论 0原文

我正在尝试绑定来自两个单独的 qooxdoo 类的两个滑块,并且正在寻找一个示例。我能够在操场上获得所需的效果:

http://tinyurl.com/7hlbwu6

// create two sliders
var slider1 = new qx.ui.form.Slider().set({minWidth:400});
var slider2 = new qx.ui.form.Slider().set({minWidth:400});
// create a controller and use the first slider as a model
var controller = new qx.data.controller.Object(slider1);
var controller2 = new qx.data.controller.Object(slider2);
// add the second slider as a target
controller.addTarget(slider2, "value", "value");
controller2.addTarget(slider1, "value", "value");

我很确定要执行此操作,我必须检查属性对象,但首先要确保到目前为止我的逻辑处于正确的轨道上。感谢您的任何建议!

I'm trying to bind two sliders from two separate qooxdoo classes and am looking for an example. I was able to get the desired effect in the playground here:

http://tinyurl.com/7hlbwu6

// create two sliders
var slider1 = new qx.ui.form.Slider().set({minWidth:400});
var slider2 = new qx.ui.form.Slider().set({minWidth:400});
// create a controller and use the first slider as a model
var controller = new qx.data.controller.Object(slider1);
var controller2 = new qx.data.controller.Object(slider2);
// add the second slider as a target
controller.addTarget(slider2, "value", "value");
controller2.addTarget(slider1, "value", "value");

I'm pretty sure to do this I would have to go through the properties object, but first wanted to make sure that I'm on the right track so far with the logic. Thanks for any suggestions!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪我入戏太深 2025-01-13 17:49:18

您不需要使用控制器。每个qooxdoo对象都有bind方法,可以双向使用:

slider1.bind("value", slider2, "value");
slider2.bind("value", slider1, "value");

基本上就是这样: http://tinyurl.com/7xy9mmv

You don't need to use the controller. Every qooxdoo objects has the bind method, which can be used in both directions:

slider1.bind("value", slider2, "value");
slider2.bind("value", slider1, "value");

Thats basically it: http://tinyurl.com/7xy9mmv

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文