I am reading a barcode, binding it to name1 variable and trying to use the variable to get a set of data from an observable.
set of data is a js file and looks something like this ;
var Observable = require("FuseJS/Observable");
var rest= Observable();
rest=[
{
did: 0,
barcode: "mado",
restaurant: "Mado Cadde",
urun: [ { title: 'Klasik Kesme Dondurma tabağı', imaget: "Assets/Mado/o1.png", price: 14.50, rating: 3},
// { title: 'Geleneksel Doğallık', imaget: "Assets/Mado/G_Dogal.png", fiyat: 13.50, Rating: 3.5},
// { title: 'Mado Kesme Dondurma Tabağı', imaget: "Assets/Mado/M_Kesme_Dondurma.png", fiyat: 13.50, Rating: 3.2},
// { title: 'Karamelli Kesme Dondurma Tabağı', imaget: "Assets/Mado/KK_Dondurma.png", fiyat: 11.00, Rating: 3.8},
// { title: 'Bademli Çikolatalı Portakallı Kesme Dondurma Tabağı', imaget: "Assets/Mado/BCPK_Dondurma.png", fiyat: 13.50, Rating: 4},
// { title: 'Balkabağı Soslu Kesme Dondurma Tabağı ', imaget: "Assets/Mado/BSK_Dondurma.png", fiyat: 13.50, Rating: 4},
// { title: 'Frambuaz Soslu Kesme Dondurma Tabağı ', imaget: "Assets/Mado/FSK_Dondurma.png", fiyat: 13.00, Rating: 3.3}
]},
{
did: 1,
barcode: "midpoint",
restaurant: "Midpoint Cadde",
urun: [ { title: 'BOĞAZ KEBAP', desc:"Şişte ızgara bonfile, domates sos, yoğurtlu köz patlıcan ve kibrit patates ile...", imaget: "Assets/Mado/qr.png", price: 39.50, rating: 4},
{ title: 'KÜLBASTI', desc:"İnce yaprak ızgara et, pilav ve patates ile...", imaget: "Assets/Mado/qr.png", price: 39.50, rating: 4},
{ title: 'SCHINITZEL MILANESE', desc:"Elmalı roka salatası ile...", imaget: "Assets/Mado/qr.png", price: 39.50, rating: 4},
{ title: 'OVA KEBAP', desc:"Tereyağı ile lezzetlenmiş pide parçaları üzerine frın antrikot, nokut ve yoğurt ile....", imaget: "Assets/Mado/qr.png", price: 39.50, rating: 4},
{ title: 'KÜLBASTI', desc:"İnce yaprak ızgara et, pilav ve patates ile...", imaget: "Assets/Mado/qr.png", price: 39.50, rating: 4},
{ title: 'KÜLBASTI', desc:"İnce yaprak ızgara et, pilav ve patates ile...", imaget: "Assets/Mado/qr.png", price: 39.50, rating: 4},
{ title: 'KÜLBASTI', desc:"İnce yaprak ızgara et, pilav ve patates ile...", imaget: "Assets/Mado/qr.png", price: 39.50, rating: 4},
{ title: 'KÜLBASTI', desc:"İnce yaprak ızgara et, pilav ve patates ile...", imaget: "Assets/Mado/qr.png", price: 39.50, rating: 4},
// { title: 'Karamelli Kesme Dondurma Tabağı', imaget: "Assets/Mado/KK_Dondurma.png", fiyat: 11.00, Rating: 3.8},
// { title: 'Bademli Çikolatalı Portakallı Kesme Dondurma Tabağı', imaget: "Assets/Mado/BCPK_Dondurma.png", fiyat: 13.50, Rating: 4},
],}
];
I read a name from a forerunnerDB database using the following code and use it to get the details from the js file above;
p2qrl= hcollection.find({}, {
$aggregate: "name"
});
console.log("Aggregated");
UIMessage=("Aggragated...");
name.value=UIMessaged;
name1.value=p2qrl[0];
At UX side I want to show the data corresponding to name1.
THE UX CODE,
<StackPanel Dock="Top">
<Text>Status:</Text>
<Text Value="{UIMessaged}">
<Clicked>
<Callback Handler="{processp}" />
</Clicked>
</Text>
<Each Items="{rest}" MatchKey="barcode">
<StackPanel ux:Template="{name1}">
<Text Value="{barcode}" />
<Each Items="{urun}">
<Grid Rows="1*,1*" Height="100">
<StackPanel Color="#072884" Height="90" Opacity="0.9" Layer="Background" Margin="0,0,0,10">
<Grid ColumnCount="2" Columns="auto,1*" Height="100">
<Text Column= "1" Value="{title} {price}" FontSize="16" Color="#FFF" Alignment="CenterRight" Margin="0,-10,0,0" />
<Text Column= "1" Value="{desc}" FontSize="10" Color="#FFF" Alignment="CenterLeft" Margin="20,35,0,0" />
<Image Column= "0" StretchMode="PointPrefer" File="{imaget}" Alignment="CenterLeft" Opacity="0.9" Margin="0,0,0,10">
</Image>
</Grid>
</StackPanel>
</Grid>
</Each>
</StackPanel>
</Each>
When I write mado at code instead of “{name1}”, I get the correct result. but when I bind it, it does not work:/
<Each Items="{rest}" MatchKey="barcode">
<StackPanel ux:Template="{name1}">
I have been informed that databinding on ux:template does not work but how do I take care of this then ?