Discussion:
[dart-misc] make action on polymer menu item clicked(coumicating from inside polymer element to html page)
Mateusz Lewandowski
2016-09-22 09:11:42 UTC
Permalink
Hi. I am searching for method how to change content of my html page(in some
div), when i click on the menu item (defined by myself not core menu
etc...) in my polymer element.
Is there any easy way to do this. Soomething like calling event and
handilng it in main.dart of html page would be great but i do not know how
to achieve that.
I hope that You help me
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Jonas Bojesen
2016-09-22 16:46:28 UTC
Permalink
Maybe what you have in mind

https://elements.polymer-project.org/elements/iron-pages

Similar with animations
https://elements.polymer-project.org/elements/neon-animation?active=neon-animated-pages

StackOverflow have a group, which should hit this type of questions.
http://stackoverflow.com/tags/dart-polymer

torsdag 22. september 2016 11.11.42 UTC+2 skrev Mateusz Lewandowski
Post by Mateusz Lewandowski
Hi. I am searching for method how to change content of my html page(in
some div), when i click on the menu item (defined by myself not core menu
etc...) in my polymer element.
Is there any easy way to do this. Soomething like calling event and
handilng it in main.dart of html page would be great but i do not know how
to achieve that.
I hope that You help me
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Mateusz Lewandowski
2016-09-22 19:19:28 UTC
Permalink
My menu could by something like https://elements.polymer-
project.org/elements/iron-pages
but i need to handle selected item in menu from this class
How to fire event from polymer element and handle it in typical dart in
main function?

@CustomTag('mainmenu-element')
class MainMenu extends PolymerElement {
// MainMenu.created() : super.created();
@observable bool isLogged=false;
@observable List menuElements = toObservable(['Home', 'News',
'Contact', 'About']);
@observable var elements = {
"Ogloszenia": "link",
"Logowanie": "link",
"Rejestracja": "rejestracja",
"O stronie": "ostronie"
};
var previous;

MainMenu.created() : super.created()
{
var storage=window.localStorage['authentication'];
if(storage!=null) {
this.isLogged = true;
}
}

void SelectItem(event, detail, target) {
if(previous!=null) {
previous.classes.remove('active');
}
target.classes.add('active');
this.previous=target;
}
}
Post by Jonas Bojesen
Maybe what you have in mind
https://elements.polymer-project.org/elements/iron-pages
Similar with animations
https://elements.polymer-project.org/elements/neon-animation?active=neon-
animated-pages
StackOverflow have a group, which should hit this type of questions.
http://stackoverflow.com/tags/dart-polymer
torsdag 22. september 2016 11.11.42 UTC+2 skrev Mateusz Lewandowski
Post by Mateusz Lewandowski
Hi. I am searching for method how to change content of my html page(in
some div), when i click on the menu item (defined by myself not core menu
etc...) in my polymer element.
Is there any easy way to do this. Soomething like calling event and
handilng it in main.dart of html page would be great but i do not know how
to achieve that.
I hope that You help me
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Jonas Bojesen
2016-09-23 05:57:12 UTC
Permalink
When a menu item is selected an iron-select event is fired by the framwork.
Listed at section Events
https://elements.polymer-project.org/elements/iron-menu-behavior

I would solve this by putting the menu and the iron-pages into same element
and bind the selected properties of them both to the same variable, just my
preference. A solution with events will also work.

torsdag 22. september 2016 21.19.32 UTC+2 skrev Mateusz Lewandowski
Post by Mateusz Lewandowski
My menu could by something like
https://elements.polymer-project.org/elements/iron-pages
but i need to handle selected item in menu from this class
How to fire event from polymer element and handle it in typical dart in
main function?
@CustomTag('mainmenu-element')
class MainMenu extends PolymerElement {
// MainMenu.created() : super.created();
@observable bool isLogged=false;
@observable List menuElements = toObservable(['Home', 'News', 'Contact', 'About']);
@observable var elements = {
"Ogloszenia": "link",
"Logowanie": "link",
"Rejestracja": "rejestracja",
"O stronie": "ostronie"
};
var previous;
MainMenu.created() : super.created()
{
var storage=window.localStorage['authentication'];
if(storage!=null) {
this.isLogged = true;
}
}
void SelectItem(event, detail, target) {
if(previous!=null) {
previous.classes.remove('active');
}
target.classes.add('active');
this.previous=target;
}
}
Post by Jonas Bojesen
Maybe what you have in mind
https://elements.polymer-project.org/elements/iron-pages
Similar with animations
https://elements.polymer-project.org/elements/neon-animation?active=neon-animated-pages
StackOverflow have a group, which should hit this type of questions.
http://stackoverflow.com/tags/dart-polymer
torsdag 22. september 2016 11.11.42 UTC+2 skrev Mateusz Lewandowski
Post by Mateusz Lewandowski
Hi. I am searching for method how to change content of my html page(in
some div), when i click on the menu item (defined by myself not core menu
etc...) in my polymer element.
Is there any easy way to do this. Soomething like calling event and
handilng it in main.dart of html page would be great but i do not know how
to achieve that.
I hope that You help me
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Loading...