對於未來的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