Polymer Ajax: Uncaught TypeError: Cannot set property 'contentType' of undefined -
i keep getting error:"uncaught typeerror: cannot set property 'contenttype' of undefined" on this.$.ajax_grid.contenttype="application/json";
i've found tons of topics such error, seems individual code related :/
<!-- @license copyright (c) 2016 polymer project authors. rights reserved. code may used under bsd style license found @ http://polymer.github.io/license.txt complete set of authors may found @ http://polymer.github.io/authors.txt complete set of contributors may found @ http://polymer.github.io/contributors.txt code distributed google part of polymer project subject additional ip rights grant found @ http://polymer.github.io/patents.txt --> <link rel="import" href="../../bower_components/polymer/polymer.html"> <dom-module id="my-afmelden-test"> <template> <iron-ajax auto url = "../../signups.json" handle-as="json" last-response="{{users}}" > </iron-ajax> <vaadin-grid id="grid" items="[[users]]" selected-items="{{selected}}"> <vaadin-grid-selection-column auto-select="[[autoselect]]"></vaadin-grid-selection-column> <vaadin-grid-column width="50px" flex-grow="0"> <template class="header">#</template> <template>[[index]]</template> </vaadin-grid-column> <vaadin-grid-column width="50px" flex-grow="0"> <template class="header"></template> <template> <img src="[[item.user.picture.thumbnail]]"></img> </template> </vaadin-grid-column> <vaadin-grid-column> <template class="header">first name</template> <template> <div class="capitalized">[[item.user.name.first]]</div> </template> </vaadin-grid-column> <vaadin-grid-column> <template class="header">last name</template> <template> <div class="capitalized">[[item.user.name.last]]</div> </template> </vaadin-grid-column> <vaadin-grid-column> <template class="header">custom selection</template> <template> <div style="display: flex; align-items: center"> <paper-button raised on-tap="_deselect" hidden="[[!selected]]">deselect</paper-button> <paper-button raised on-tap="_select" hidden="[[selected]]">select</paper-button> <paper-checkbox checked="{{selected}}">selected</paper-checkbox> </div> </template> </vaadin-grid-column> </vaadin-grid> <paper-button on-tap="_myafmelden" raised>afmelden</paper-button> <paper-button on-tap="_exportjson" raised>export json</paper-button> <paper-button on-tap="_exportcsv" raised>export csv</paper-button> </template> <iron-ajax id="ajax_grid" method="post" url="/cgi-bin/gerecht-toevoegen.py" handle-as="json" on-response="_myafmelden_responsehandler"> </iron-ajax> </template> <script> polymer({ is: 'my-afmelden-test', properties: { selected: { type: array, }, }, _myafmelden: function() { console.log("derpdiedierp"); this.$.ajax_grid.contenttype="application/json"; this.$.ajax_grid.body={ "selection":this.selected }; this.$.ajax_grid.generaterequest(); }, _myafmelden_responsehandler: function(request) { console.log("response: " + request_confirm); }, _exportjson: function() { console.log(json.stringify(this.selected)); }, // _exportcsv: function() { // console.log(this.selected.map(p => `"${p.name.first}", "${p.name.last}"`).join("\n")); // } }); </script> </dom-module> <!-- https://cdn.vaadin.com/vaadin-grid/2.0.0-beta1/demo/selection.html -->
Comments
Post a Comment