如何确保在 Spark 列表中始终选择某些内容? [英] How do I make sure that there is always something selected in a Spark List?

查看:20
本文介绍了如何确保在 Spark 列表中始终选择某些内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于 dataProvider 的火花列表.随着应用程序的运行,dataprovider 中的数据可能会发生变化,并且 dataProvider 中的数据也可以交换为不同的数据

I have a spark list, which is based on a dataProvider. As the application runs, the data in the dataprovider can change, and also the dataProvider can be swapped for a different one

我需要做的是确保列表中始终选择某些内容(除非它是空的)

What I need to do is make sure that something is always selected in the list (unless it is empty)

推荐答案

您只需将列表实例的属性 requireSelection 设置为 true.

You simply have to set the property requireSelection of your list instance to true.

在 MXML 中,它将是:

In MXML, it would be:

<s:List id="myList" requireSelection="true">

这篇关于如何确保在 Spark 列表中始终选择某些内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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