【问题标题】:not able to populate data in table in iron-ajax in TRIRIGA无法在 TRIRIGA 的 Iron-ajax 中填充表中的数据
【发布时间】:2018-02-22 06:47:06
【问题描述】:

我在使用 Iron-ajax 填充三块表中的数据时遇到问题。

我的 empleelist.json 文件位于 .html 文件所在的同一文件夹中。此外,当我调试它时,我发现了 URL:

http://XXXX:port/p/components/r/en-US/l/tut-people/employeelist.json 之后,我得到的值是 json。

我称它为:

<link rel="import" href="../triblock-table/triblock-table.html">
<link rel="import" href="../iron-ajax/iron-ajax.html">
<link rel="import" href="../iron-icon/iron-icon.html">
<link rel="import" href="../iron-icons/iron-icons.html">
<link rel="import" href="../paper-listbox/paper-listbox.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../paper-item/paper-icon-item.html">
<link rel="import" href="../paper-item/paper-item-body.html">



<dom-module id="tut-person">
<style is="custom-style">
  #table1 {
    color: white;
    --triblock-table-header-background-color: violet;
    --triblock-table-header-color: green;
    --triblock-table-even-row-background-color: rgb(80, 80, 80);
    --triblock-table-odd-row-background-color: rgb(40, 40, 40);
    --triblock-table-row-hover-background-color: darkblue;
  }
</style>
<template>
<h1>Table Layout</h1>
<iron-ajax url="employeelist.json" handle-as="json" last-response="{{employees}}"  content-type="application/json" auto></iron-ajax>

<triblock-table id="table1"  data="{{employees}}" style="width:100%; height:250px;">
    <triblock-table-column title="Employee ID" property="id"></triblock-table-column>
  <triblock-table-column title="Name" property="Name"></triblock-table-column>
  <triblock-table-column title="First Name" property="First Name"></triblock-table-column>
  <triblock-table-column title="Last Name" property="Last Name"></triblock-table-column>
  <triblock-table-column title="Status" property="Status"></triblock-table-column>
</triblock-table>
</template>

</dom-module>
<script>
Polymer({

is: "tut-person",
behaviors: [TriPlatViewBehavior]
});

</script>

但是,我无法在表格中填充数据。

JSON 文件:

[
    {
"id":123456
"Name":"Kumar Shorav"
"First Name":"Kumar"
"LastName":"Shorav"
"Status":"Active"
    },
{
"id":12346
"Name":"Kumar Shorav1"
"First Name":"Kumar1"
"LastName":"Shorav1"
"Status":"Active"
    }
]

【问题讨论】:

    标签: user-interface iron-ajax


    【解决方案1】:

    我能够解决这个问题。这是因为 json 字符串为空。反过来,last-response 变量设置为 null,所以我在屏幕上没有得到任何响应。更正 Json 字符串后,这是有效的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-21
      • 1970-01-01
      • 2018-05-18
      • 2013-07-04
      • 1970-01-01
      • 2015-04-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多