我的 Dashcode 项目中有一个列表 Controller ,它从动态源中提取数据。
在我的列表 Controller 加载它的数据后,我想将它的选定索引设置为 0 - 以便显示列表中第一项的信息。我一辈子都想不出怎么做。我试过:
function load()
{
dashcode.setupParts();
var list = document.getElementById("itemsList");
//list.setSelectionIndexes(0); // nope
//list.selectedIndex = 0; // nope
}
最佳答案
无需为此编写任何代码。在检查器中编辑列表的属性,并在属性选项卡中取消选中允许空选择。在不允许空选择的情况下,加载列表时将选择列表中的第一项。
关于javascript - 在 Dashcode 列表 Controller 中设置选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2795867/