对于未来的Google,因为是绝对没有文档的任何地方这一点:
当详细视图连接两个领域来自同一数据源:
XML
<?xml version="1.0" encoding="utf-8"?>
<immobilier>
<bien>
<ID>1453</ID>
<Titre>Maison/Villa F4</Titre>
<Ville>Sainte Clotilde</Ville>
<Quartier>BRETAGNE</Quartier>
</bien>
</immobilier>
结合领域Ville和Quartier创建一个像这样的值转换器:
mapAdresse = Class.create(DC.ValueTransformer,{
transformedValue: function(value){
if (value.trim() != "") {
//Replace immoListe with your source name
var itemDataSource = dashcode.getDataSource('immoListe');
//THIS IS THE MOST IMPORTANT : HOW TO FIND THE CURRENTLY SELECTED ITEM INDEX
var selectedIndex = document.getElementById('list').selectedIndex;
//Use the selectedIndex to find the record in the datasource
var quartier = itemDataSource.selection().valueForKey("bien")[selectedIndex].valueForKey("Quartier");
//Concatenate to your liking
if (quartier.trim() != "") value = value + ", "+ quartier;
}
return value;
}
});
为什么这不记录在任何地方?打败我 !!
如果你想在列表中有2个字段(如Master/Detail的DashCode splitview Master侧),那么你需要使用2个独立的字段。这在这种情况下不起作用。 – ferdil 2011-05-06 19:48:55