Progamatically设置SelectedItem / Index [英] Set SelectedItem/Index Progamatically

查看:80
本文介绍了Progamatically设置SelectedItem / Index的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景

我在浏览屏幕1上使用自定义渲染代码创建了一个分组列表视图。 当我在详情屏幕2上保存项目时, 我有使用默认showcreen刷新屏幕1的代码。 我这样做是为了强制页面重新呈现新数据。

I have created a grouped listview using custom render code on browse screen 1.  When I save an item on detail screen 2,  I have code to refresh screen 1 using the default showscreen.  I do this to force the page to rerender with the new data.

我保存的代码如下。 点击事件会强制页面刷新。

My code to save is below.  The click event forces the page refresh.

问题

刷新页面后,不再选择所选项目。 如何以编程方式重置列表中的所选项目?

After I refresh the page the selected item is no longer selected.  How do I programmatically reset the selected item in the list?

    if (screen.UserStory.details.hasEdits) {
        $('ul').css("visibility", "hidden");
        myapp.acceptNestedChanges().then(function () {
            myapp.saveChanges().then(function () {
                lastProjectDisplayed = "";
                $("#btnUserStoriesShow").click().then(function() {
                    //$('#spanuserstories' + screen.UserStory.UserStoryID).click();
                });
               
            });
        });
    }
    else {
        myapp.cancelNestedChanges();
    }

jb

推荐答案

您应该能够在支持列表的屏幕上访问可视集合,并将其selectedItem属性设置为数据集合中存在的特定实体。例如,要选择列表中的第一项,请编写类似"screen.UserStories.selectedItem
= screen.UserStories.data [0];"

You should be able to access the visual collection on the screen that backs the list and set its selectedItem property to a specific entity present in the data collection. For example, to select the first item in the list, write code like "screen.UserStories.selectedItem = screen.UserStories.data[0];"

的代码。这项工作适合你吗?

Does this work for you?


这篇关于Progamatically设置SelectedItem / Index的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆