1

我有一个包含一堆对象的铁列表,我希望它们在发生将输入数据更改为铁列表的事件时重新定位。我需要每个对象都引用列表的顶部,但还没有找到任何解决方案。我能让它们表现得像绝对对象的唯一方法是在主要项目之前放置一个 div,如下所示。但是当我更改数据时,项目的数量保持不变,只有一些(与我的数组中的新元素一样多)重新定位。如果从以前的数据中剩下更多的项目,即使我绑定了要从数据中读取的高度,它们也会保持在原来的位置。

      <iron-list id="myID" items="[[myInput]]" as="myItem" selection-enabled multi-selection>
        <template>              

         <!-- I have to have this to get the main items to position referenced to the top of the iron-list -->
        <div id="referenceDiv" style="left:0px; float:left; width: 100%; min-height:1px; background-color:blue; top: 0px; display: none;"></div>

        <div id="mainItemID" style$="background-color:#FFF; height:[[myItem.height]]px; top:[[myItem.top]]px; border-radius: 3px; border-color:#333; border-width:1px; border-style: solid;;"></div>


       <div id="bottomGuidID" style="left:0px; float:left; width: 100%; min-height:1px; background-color:lightblue; top: 1920px;"></div>

        </template>
      </iron-list> 
4

0 回答 0