如何使用来自两个字段的值显示下拉选项

How to display DropDown options using values from two fields

我有一个显示指标列表的下拉菜单。我希望它显示为来自两个字段 IndicatorCodeIndicatorName 的选项值,理想情况下它还应该有一个“:”或介于两者之间的任何其他字符.作为 DropDown 的绑定,我有:

选项: @datasource.items,

: @datasource.item

Names: 我尝试了以下但效果不佳 @datasources.MyDatasource.items..IndicatorCode+':'+@[=36= ..指标名称

假设您有 Person model/datasource 并且您需要在 Dropdown 用户的 Display Name (First Name + Last Name) 中显示。在这种情况下,names 下拉列表的 属性 的绑定将如下所示:

getPeopleDisplayNames(@datasources.People.items)

这里是 getPeopleDisplayNames 函数的客户端脚本

function getPeopleDisplayNames(personList) {
  if (personList) {
    return personList.map(function (person) {
      return person.FirstName + ' ' + person.LastName;
    });
  }

  return personList;
}

以下是来自 Google 组的几个相关主题: https://groups.google.com/forum/#!topic/appmaker-users/0zGl85fEU4Y/discussion https://groups.google.com/forum/#!topic/appmaker-users/Pg6cyZBIOMk/discussion