There are several questions that relate to this issue but none mentions issue I am facing. Before I can ask a question there is a bit of history:
- Long story short: stepped on polymer, liked the idea, found its not really for web sites (subfolders not working) and attempting using it in cooperation with nwjs for desktop app. Debugging in firefox, chrome and nwjs - several issues how to setup app for debugging.
- As many others after learning about polymer first choice is to get starter.
- A full node ordeal follows this one (node, bower, downloading components)
- Starter Kit includes some basic source on how to route and how to implement couple of most common operations - segment the application, responsive design, effects
- Typically in an app one wants to add some widgets, and one of often used is dropdown-menu.
- dropdown example is not provided in starter kit but examples are available in polymer documentation, so one very quickly ends up with the situation like described in: Polymer's paper-dropdown-menu shows uncollapsed
Solution follows - include component handlers (edit
to elements.html
and include following line:<link rel="import" href="../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
Often the original design problem resolves, we get dropdown, but in some cases it is half functional, more research follows and you learn you need to add also:
<link rel="import" href="../bower_components/paper-listbox/paper-listbox.html">
So 1st, when I add above lines to elements.html and add typical dropdown to any section. Like:
<paper-dropdown-menulabel="Browser to run?">
<paper-listbox class="dropdown-content" attr-for-selected="value" selected="IE" >
<paper-item value="IE" >Internet Explorer</paper-item>
<paper-item value="FF">Firefox</paper-item>
<paper-item value="CRB">Google Chrome</paper-item>
<paper-item value="PJS">PhantomJS (browsing do not show)</paper-item>
</paper-listbox>
</paper-dropdown-menu>
Voila! It starts singing on Ubuntu Linux with Chromium, Firefox and nwjs. Lets move to windows...
Sorry, windows is no go. Firefox reporting errors in console, chromium has security origin constrains when app is run from the file, nwjs shows everything but refuse to select item, popup opens but no selection is actually made. Then you start thinking is it that some handler shall be placed (but then linux variant works) are events fired (nwjs debugger says yes you can observe them). Yet no selection is made. There was an issue of not closing selection popup by clicking outside of selection popup, one learns to bower update components to resolve issues. Normal learning curve. But apart from explaining of how to design polymer (on polymer doc site) nobody actually documents how to script it so...
Additional questions popup in mind:
- I have several dropdowns - how to distinguish and embed/collect data from/to? Use ID's? Use name attribute? Enclosing in iron-form? Best approach?
- How to populate dropdowns from the database (web service etc etc) - like this attempt here: Polymer paper-dropdown-menu - is this prefered / intended way of using polymer or it is just personal style?
Main question is:
Is there some workable example which address common issues (like listed above - multiple identifiable dropdowns, populated dynamically) with polymer's paper-dropdown that works cross browser cross platform - which can be quoted and tested?
paper-item
there too? How are you serving the app, usinggulp serve
? Also,dom-repeat
is the easiest way to go for dynamically populating things in polymer – Alan Dávalos