Hi,
I am trying to work on a layout where I’ve got 2 scrollviews that both take up 50% of the screen. Here is my code so far.
<App Theme="Basic">
<ClientPanel>
<JavaScript>
console.log("INIT");
var Observable = require("FuseJS/Observable");
fruits = Observable(
{ name: 'Item1' , color: 'red' },
{ name: 'Item2' , color: 'yellow' },
{ name: 'Item3' , color: 'green' },
{ name: 'Item4', color: 'yellow' },
{ name: 'Item5' , color: 'red' },
{ name: 'Item6' , color: 'yellow' },
{ name: 'Item7' , color: 'green' },
{ name: 'Item8', color: 'yellow' },
{ name: 'Item9' , color: 'red' },
{ name: 'Item10' , color: 'yellow' },
{ name: 'Item11' , color: 'green' },
{ name: 'Item12', color: 'yellow' });
fruits2 = Observable(
{ name: 'Apple' , color: 'red' },
{ name: 'Lemon' , color: 'yellow' },
{ name: 'Pear' , color: 'green' },
{ name: 'Banana', color: 'yellow' },
{ name: 'Apple' , color: 'red' },
{ name: 'Lemon' , color: 'yellow' },
{ name: 'Pear' , color: 'green' },
{ name: 'Banana', color: 'yellow' });
searchString = Observable("");
// ignore case so just convert both to lowercase before comparison
function stringContainsString(main,filter){
return main.toLowerCase().indexOf(filter.toLowerCase()) != -1;
}
var filteredItems = fruits.where(function(e){
return Observable(function() {
return stringContainsString(e.name, searchString.value);
});
});
module.exports = {
filteredItems: filteredItems,
fruits2: fruits2,
searchString: searchString};
</JavaScript>
<!-- Page Content -->
<Page Margin="10" >
<Grid RowCount="2">
<StackPanel>
<TextInput Value="{searchString}" PlaceholderText="Search..." />
<ScrollView>
<StackPanel Margin="0,0,10,0">
<Each Items="{filteredItems}">
<Panel Background="#FFF" Margin="5">
<StackPanel Orientation="Horizontal" Margin="10">
<Text Value="{name}" Alignment="CenterLeft" TextWrapping="NoWrap" Margin="10,0,0,0" FontSize="20" />
</StackPanel>
</Panel>
<Rectangle Height="1" Fill="#cccccc" Margin="5,0,5,0" />
</Each>
</StackPanel>
</ScrollView>
</StackPanel>
<Rectangle Height="10" Fill="#cccccc" />
<StackPanel Margin="10,0,10,0">
<FineLine />
<ScrollView>
<StackPanel>
<Each Items="{fruits2}">
<Panel>
<StackPanel Orientation="Horizontal">
<Text Value="{name}" Alignment="CenterLeft" TextWrapping="NoWrap" Margin="10,0,0,0" />
<Text Value="{color}" Alignment="CenterLeft" TextWrapping="NoWrap" Margin="2,0,0,0" />
</StackPanel>
<Switch Alignment="CenterRight" />
</Panel>
<Rectangle Height="1" Fill="#cccccc" Margin="5,0,5,0" />
</Each>
</StackPanel>
</ScrollView>
</StackPanel>
</Grid>
</Page>
</ClientPanel>
</App>
I’ve tried putting both scrollviews in a grid but then it just ends up overlapping each other like seen in the image here.
Any tips on how to get the alignment rigt?