migration - Polymer 1.0 Data binding when object changes -


i'm having trouble understanding how data-binding works now.

on index page i've got object (obtained json restful service), works fine when applied custom element like:

<main-menu class="tiles-container ofvertical flex layout horizontal start"       menuitems="{{menuitems}}"> </main-menu>  var maintemplate = document.queryselector('#fulltemplate'); maintemplate.menuitems = json.parse(data.getdesktopresult); 

this works expected, , when load page different users, main-menu changes should show each user's desktop configuration. (this menuitems object reflects position , size of each desktop module each user).

now, users used able change configuration on go, , on polymer 0.5 had no problem that, changed maintemplate.menuitems object , that, reflected on template instantly.

as migrated polymer 1.0, realized changes on object wouldn't change visible, it's more complicated this, doing doesn't work:

<paper-icon-button id="iconback" icon="favorite" onclick="testing()"></paper-icon-button>  function testing(){    debugger;    maintemplate = document.queryselector('#fulltemplate');    maintemplate.menuitems[0][0].modulesize = 'smamodule'; } 

the object changes nothing happens on screen until save db , reload page.

am missing /do need else on polymer 1.0 have elements update when change object passed property?

before ask, i've got properties setted notify: true, inly thing found different, still doesn't work

thanks reading!

edit:

this code menuitems used in:

<template is="dom-repeat" items="{{menuitems}}" as="poscol">    <div class="positioncolum horizontal layout wrap flex">        <template is="dom-repeat" items="{{poscol}}" as="mitem" index-as="j">            <main-menu-item class$="{{setitemclass(mitem)}}"                mitem="{{mitem}}"                index="{{mitem.totalorder}}"                on-click="itemclick"                id$="{{setitemid(index, j)}}">            </main-menu-item>        </template>    </div> </template> 

main-menu-item set of divs changes size , color based on object properties

you need use mutation helper functions if want modify elements inside object or array otherwise dom-repeat won't notified changes (check docs):

function testing(){    debugger;    maintemplate = document.queryselector('#fulltemplate');    this.set('maintemplate.0.0.modulesize', 'smamodule'); } 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -