在 Palm webOS 中使用 Ares IDE 预过滤多个列表选择器中的列表

发布于 2024-10-29 16:42:09 字数 1407 浏览 2 评论 0原文

我在 Ares 中使用列表选择器填充了两个列表,这样列表 1 包含 A、B、C、D,列表 2 包含 E、F、G、H。如何预过滤第二个列表,以便从列表中选择项目 A 时一,它预过滤列表二只显示 F,G?

到目前为止我的代码是:

function FinalAssistant(argFromPusher) {
}

FinalAssistant.prototype = {
setup: function() {
    Ares.setupSceneAssistant(this);
},
cleanup: function() {
    Ares.cleanupSceneAssistant(this);
},
listSelector1Change: function(inSender, event) {
    this.$.getListSelector2.choices["F"]

    },  
};

编辑添加:

我已经添加了回调函数和清理方法,但它仍然没有传递参数 F & G.

代码如下

FinalAssistant.prototype = {
setup: function() {
    Ares.setupSceneAssistant(this);
    this.controller.listen("listSelector1", Mojo.Event.listSelector1Tap, this.listSelector1Tap.bindAsEventListener(this));
},
cleanup: function() {
    Ares.cleanupSceneAssistant(this);
    Mojo.Event.stopListening(this.controller.listSelector1,Mojo.Event.listSelector1Tap,this.listSelector1Tap)

},

listSelector1Tap: function(inSender, event) {
    switch (event.choices.label)
{
    case 'A':
        this.listModel2.choices = [{label: "F"}, {label: "G"}];
        this.controller.modelChanged(this.listModel2);
        break;
    case 'B':
        this.listModel2.choices = [{label: "H"}, {label: "I"}];
        this.controller.modelChanged(this.listModel2);
        break;    
    }    
},
};

Mojo Log info错误说Mojo.Event.listen 'target'参数必须被定义

I have populated two lists using listselectors in Ares, such that list ONE contains A, B, C, D and list TWO contains E, F, G, H. How can I prefilter the second list such that when item A is selected from list ONE, it prefilters list TWO to show just F,G?

The code I have so far is:

function FinalAssistant(argFromPusher) {
}

FinalAssistant.prototype = {
setup: function() {
    Ares.setupSceneAssistant(this);
},
cleanup: function() {
    Ares.cleanupSceneAssistant(this);
},
listSelector1Change: function(inSender, event) {
    this.$.getListSelector2.choices["F"]

    },  
};

edit to add:

I have added the callback function and cleanup method but its still not passing the parameters F & G.

The code is as follows

FinalAssistant.prototype = {
setup: function() {
    Ares.setupSceneAssistant(this);
    this.controller.listen("listSelector1", Mojo.Event.listSelector1Tap, this.listSelector1Tap.bindAsEventListener(this));
},
cleanup: function() {
    Ares.cleanupSceneAssistant(this);
    Mojo.Event.stopListening(this.controller.listSelector1,Mojo.Event.listSelector1Tap,this.listSelector1Tap)

},

listSelector1Tap: function(inSender, event) {
    switch (event.choices.label)
{
    case 'A':
        this.listModel2.choices = [{label: "F"}, {label: "G"}];
        this.controller.modelChanged(this.listModel2);
        break;
    case 'B':
        this.listModel2.choices = [{label: "H"}, {label: "I"}];
        this.controller.modelChanged(this.listModel2);
        break;    
    }    
},
};

the Mojo Log info error says Mojo.Event.listen 'target' parameter must be defined

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

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

发布评论

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

评论(1

第七度阳光i 2024-11-05 16:42:09

你想做的事情相当简单。首先,因为它似乎不是,所以您需要为 Mojo.Event.listTap 设置回调,就像在您的设置函数中一样:

this.controller.listen('list1', Mojo.Event.listTap, this.list1Tap.bindAsEventListener(this))

然后您需要执行 stopListening 在你的清理中以避免留下僵尸监听器。

另外,由于我在这里没有看到它,因此您需要在某个地方存储列表模型,即。包含列表项目的对象。这里我假设它被称为 list2list2Model

至于 list1Tap,您需要类似以下内容:

list1Tap: function(event) {
    switch (event.item.label)
    {
        case: 'A':
            this.list2Model.items = [{label: "F"}, {label: "G"}];
            this.controller.modelChanged(this.list2Model);
            break;
    }
},

这样就可以了。显然,您需要更多的结构才能使其 100% 工作,但这就是完成您所询问的部分的方法。

What you want to do is fairly straightforward. First, since it doesn't appear to be, you need to set up a callback for Mojo.Event.listTap like so in your setup function:

this.controller.listen('list1', Mojo.Event.listTap, this.list1Tap.bindAsEventListener(this))

And then later you need to do a stopListening in your cleanup to avoid leaving a zombie listener.

Also, since I don't see it given here, you'll need somewhere to store the list model, viz. the objects that contain the items for your list. Here I'll assume it's called list2Model for list2.

As for list1Tap, you'll need something like:

list1Tap: function(event) {
    switch (event.item.label)
    {
        case: 'A':
            this.list2Model.items = [{label: "F"}, {label: "G"}];
            this.controller.modelChanged(this.list2Model);
            break;
    }
},

And that should do it. Obviously there's a lot more structure you'll need to get it working 100%, but that's how to do the part you asked about.

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