I have a feed of GP Practice addresses the start of which is as follows (not the whole feed which is over 16000 entries - still got to figure out paging)
[{"Address1":"73 UPPER WICKHAM LANE","Address2":"WELLING","Address3":"KENT","Address4":"","Address5":"","CloseDate":"\/Date(-62135596800000+0000)\/","ContactName":"","ContactTelephone":"020 88541910","EmailAddress":"","LastUpdatedDate":"\/Date(1434749040000+0100)\/","Name":"(GPSI) DR AC BARUAH","OpenDate":"\/Date(-62135596800000+0000)\/","OrgSubTypeCode":"B","PCTCode":"TAK","Postcode":"DA16 3AF","PracticeCode":"Y00789","PracticeType":"0","SendToEDTHub":false,"SendToEmail":false,"SendToPrinter":true,"Status":"C"},
{"Address1":"73 UPPER WICKHAM LANE","Address2":"","Address3":"WELLING","Address4":"KENT","Address5":"","CloseDate":"\/Date(-62135596800000+0000)\/","ContactName":"","ContactTelephone":"020 88541910","EmailAddress":"","LastUpdatedDate":"\/Date(1434749040000+0100)\/","Name":"(GPSI) DR AP DHITAL","OpenDate":"\/Date(-62135596800000+0000)\/","OrgSubTypeCode":"B","PCTCode":"TAK","Postcode":"DA16 3AF","PracticeCode":"Y00788","PracticeType":"0","SendToEDTHub":false,"SendToEmail":false,"SendToPrinter":true,"Status":"C"},
{"Address1":"2 CHURCH AVENUE","Address2":"","Address3":"SIDCUP","Address4":"KENT","Address5":"","CloseDate":"\/Date(-62135596800000+0000)\/","ContactName":"","ContactTelephone":"020 83021114","EmailAddress":"","LastUpdatedDate":"\/Date(1434749040000+0100)\/","Name":"(GPSI) DR HL BHATTAD","OpenDate":"\/Date(-62135596800000+0000)\/","OrgSubTypeCode":"B","PCTCode":"TAK","Postcode":"DA14 6BU","PracticeCode":"Y00791","PracticeType":"0","SendToEDTHub":false,"SendToEmail":false,"SendToPrinter":true,"Status":"C"}
.
.
.
this is returned with the mime-type application/json to the calling application
The following code is the HTML snippet which I thought would make a call to get the data and display it.
<paper-material elevation="1">
<div id="GPPracticeContainer">
GP List
{{data}}
<template is="dom-repeat" items="{{data}}"
<p>{{item.Name}}</p>
</template>
</div>
</paper-material>
</paper-header-panel>
<iron-ajax auto id="GPCollection"
url="/GPPractices.ashx"
handle-as="json"
last-response="{{data}}"
on-response="handleGPCollection">
</iron-ajax>
and finally the javascript
<script>
function handleKeyPress(e) {
if (e.keyCode == 13) {
alert('off to search for something!');
}
};
Polymer({
is: "practice-list",
hideSearch: {
type: Boolean,
value: false
},
handleGPCollection: function(request) {
alert('GP Practices collected ' + request);
},
ready: function () {
this.hideSearch = true;
this.$.searchText.keyup(function (e) {
alert('off to search for something!');
});
},
srchandler: function () {
// search for contents of search box is showing, otherwise show it.
if (!this.hideSearch)
{
alert('off to search for something!');
}
else {
this.hideSearch = !this.hideSearch;
if (!this.hideSearch) {
this.$.searchText.focus();
}
}
}
});
</script>
Trouble is although the alert box appears showing the data has been read - and returns Object CustomEvent No data appears.
anyone know how I can
a) Find out what is going wrong b) Get it to display say the Name of each practice
Thanks
I am missing the closing'>' of the template. It should read
<template is="dom-repeat" items="{{data}}">
<p><span>{{item.PracticeCode}}</span> - <span>{{item.Name}}</span></p>
</template>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.