polymer - Using the custom element body for data -
i looking implementing custom datagrid want data provided inline contents of custom element:
<x-datagrid> <row> <col>value 1</col><col>value 2</col> </row> </x-datagrid>
you can achieve menu , tab elements populate based on this...how done though? have looked @ component source core-dropdown-menu:
https://github.com/polymer/core-dropdown-menu/blob/master/core-dropdown-menu.html
doesn't tell me much...where else look?
i able polymer.dom(this)
in ready
function.
an example, loads data child <option>
elements component's data
property:
ready: function() { var self = this; // since "this" gets lost in foreach polymer.dom(this).queryselectorall('option').foreach(function(opt) { self.push('data', {id: opt.value, text: opt.textcontent}); }); },
where component looks like:
<my-component> <option value="1">option 1</option> <option value="2">option 2</option> <option value="3">option 3</option> </my-component>
Comments
Post a Comment