0

I am facing problem in populating data in triblock-table using iron-ajax.

I have my empleelist.json file in the same folder where .html file. Moreover, When I debug it and then I found URL :

http://XXXX:port/p/components/r/en-US/l/tut-people/employeelist.json and after this, I am getting the value as json.

I am calling it as:

<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>

However, I am not able to populate data in the table.

JSON file:

[
    {
"id":123456
"Name":"Kumar Shorav"
"First Name":"Kumar"
"LastName":"Shorav"
"Status":"Active"
    },
{
"id":12346
"Name":"Kumar Shorav1"
"First Name":"Kumar1"
"LastName":"Shorav1"
"Status":"Active"
    }
]
Kumar
  • 955
  • 5
  • 20
  • 50

1 Answers1

0

I was able to fix this. This was because json string was null. In turn, last-response variable was set to null so I was getting no response on screen. After correcting Json string, this was working.

Kumar
  • 955
  • 5
  • 20
  • 50