Hi,
How to navigate from sperate Sidebar.ux
thanks.
Hi,
How to navigate from sperate Sidebar.ux
thanks.
You need to use Observables for now like this:
TabBarNavigation.ux
:
<App Background="#333">
<JavaScript>
var Observable = require('FuseJS/Observable');
var active_page = Observable('page1');
function set_page_1 () {
debug_log("setpage1");
active_page.value = 'page1';
}
function set_page_2 () {
debug_log("setpage2");
active_page.value = 'page2';
}
function set_page_3 () {
debug_log("setpage3");
active_page.value = 'page3';
}
function set_page_4 () {
debug_log("setpage4");
active_page.value = 'page4';
}
module.exports = {
active_page: active_page,
set_page_1: set_page_1,
set_page_2: set_page_2,
set_page_3: set_page_3,
set_page_4: set_page_4,
}
</JavaScript>
<DockPanel>
<iOS.StatusBarConfig Style="Light" />
<StatusBarBackground Dock="Top"/>
<BottomBarBackground Dock="Bottom"/>
<PageControl ux:Name="pages" Active="{active_page}">
<Page ux:Name="page1" Background="#34495e">
<Image File="Assets/fuse-logo.png" StretchDirection="DownOnly" />
</Page>
<Page ux:Name="page2" Background="#3498db">
<Image File="Assets/fuse-logo.png" StretchDirection="DownOnly" />
</Page>
<Page ux:Name="page3" Background="#aa3377">
<Image File="Assets/fuse-logo.png" StretchDirection="DownOnly" />
</Page>
<Page ux:Name="page4" Background="#88cc22">
<Image File="Assets/fuse-logo.png" StretchDirection="DownOnly" />
</Page>
</PageControl>
<NavGrid Dock="Bottom"/>
</DockPanel>
</App>
NavGrid.ux
:
<Grid ColumnData="1,1,1,1" Height="45">
<Style>
<Image Padding="7" />
</Style>
<Panel Background="#34495e">
<Image ux:Name="tabBarImage1" File="Assets/icon-hexagon.png" />
<Clicked>
<Callback Handler="{set_page_1}" />
</Clicked>
</Panel>
<Panel Background="#3498db">
<Image ux:Name="tabBarImage2" File="Assets/icon-star.png" />
<Clicked>
<Callback Handler="{set_page_2}" />
</Clicked>
</Panel>
<Panel Background="#aa3377">
<Image ux:Name="tabBarImage3" File="Assets/icon-square.png" />
<Clicked>
<Callback Handler="{set_page_3}" />
</Clicked>
</Panel>
<Panel Background="#88cc22">
<Image ux:Name="tabBarImage4" File="Assets/icon-triangle.png" />
<Clicked>
<Callback Handler="{set_page_4}" />
</Clicked>
</Panel>
</Grid>
Hi,
https://drive.google.com/open?id=0B1U0ByQZk0fjalNBM2RnNXNhdlU
The Above link is my project…
When You click in logout button from sidebar, you need to go login page…
How can i do for that?
diff --git a/MainView.js b/MainView.js
index c1e6c17..972ff1a 100644
--- a/MainView.js
+++ b/MainView.js
@@ -1,8 +1,14 @@
var Observable = require('FuseJS/Observable');
-
function Login(){
console.log("Clicked");
+ active_nav.value = "Dashboard";
}
+ function Logout() {
+ active_nav.value="Login";
+ }
+ var active_nav = Observable('Login')
module.exports = {
-
+ Login: Login,
+ Logout: Logout,
+ active_nav: active_nav
};
\ No newline at end of file
diff --git a/MainView.ux b/MainView.ux
index d8749af..40d1f94 100644
--- a/MainView.ux
+++ b/MainView.ux
@@ -38,7 +38,7 @@
</Button>
</Style>
-
<HierarchicalNavigation ux:Name="nav" Duration="0.5" Easing="CubicInOut" />
-
<HierarchicalNavigation ux:Name="nav" Duration="0.5" Easing="CubicInOut" Active="{active_nav}" />
<!-- Login Page -->
<Page ux:Name="Login" Width="100%" Margin="30,0,30,0" Alignment="Center">
@@ -48,11 +48,7 @@
<TextInput ux:Name="Username" Value=""></TextInput>
<Text Value="Password" />
<TextInput ux:Name="Password" IsPassword="true" />
-
<Button Text="Login" Alignment="Center">
-
<Clicked>
-
<NavigateTo Context="nav" Target="Dashboard" />
-
</Clicked>
-
</Button>
-
<Button Text="Login" Alignment="Center" Clicked="{Login}" />
</StackPanel>
</Page>
diff --git a/Sidebar.ux b/Sidebar.ux
index f7b5dd4…70dbd95 100644
— a/Sidebar.ux
+++ b/Sidebar.ux
@@ -66,11 +66,7 @@
</Grid>
<StackPanel Margin="0,50,0,0">
<StackPanel ux:Name="logout">
-
<Button Text="Logout" Alignment="Center">
-
<Clicked>
-
<!--NavigateTo Context="nav" Target="Login" /-->
-
</Clicked>
-
</Button>
-
<Button Text="Logout" Alignment="Center" Clicked="{Logout}" />
</StackPanel>
</StackPanel>
</StackPanel>
Thanks Dude.
Thanks a lot.