Wuu Posted July 29, 2015 Report Posted July 29, 2015 {this.state.c.map(function(k,i){ this.state.ri.map(function(kk,ii){ console.log(this.state.ri[ii].ID); <-- STRĀDĀ console.log(this.state.ri[k.id].ID); <-- STRĀDĀ }.bind(this)); return (<div key={i}> <div className="row cells12"> <div className="cell"> <span className="mif-bookmark"></span> </div> <div className="cell colspan3"> {this.state.ri[k.id].ID} <-- NESTRĀDĀ </div> </div> </div>); }.bind(this))} TypeError: this.state.ri[k.id] is undefined A huļi? Quote
0 codez Posted July 29, 2015 Report Posted July 29, 2015 Izvadi pirms tās nestrādājošās rindas console.log(JSON.stringify(this.state.r), JSON.stringify(k.id)) Quote
0 Wuu Posted July 29, 2015 Author Report Posted July 29, 2015 (edited) [{"ID":"18","item_id":"2","item_amount_stock":"5","item_amount_in_cart":"0","item_amount_preordered":"0","item_amount_sold":"0","item_timestamp":"2015-07-22 12:30:59","last_edit_timestamp":"2015-07-22 12:30:59","item_id_catalog":"prod2","item_name_catalog":"Spilvens","item_measurement_unit":"pcs"},{"ID":"12","item_id":"4","item_amount_stock":"25","item_amount_in_cart":"0","item_amount_preordered":"0","item_amount_sold":"0","item_timestamp":"2015-07-22 10:01:15","last_edit_timestamp":"2015-07-22 11:54:05","item_id_catalog":"prod3","item_name_catalog":"Desa","item_measurement_unit":"kg"}] 0 JSON.parse(JSON.stringify(this.state.ri[0])) <-- NESTRADĀ "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data" JSON.stringify(this.state.ri[0]) <-- Strādā. Nu wtf :) Edited July 29, 2015 by Wuu Quote
0 briedis Posted July 29, 2015 Report Posted July 29, 2015 Nezinu kā tas REACT tur darās, bet gan jau this konteksts pazūd... Quote
0 Wuu Posted August 6, 2015 Author Report Posted August 6, 2015 for (var i = 0; i < json[1].output.length; i++) { json[1].output[i].edit = function() { console.log(json[1].output.ID); this.props.handleMenu(this,'functions',new Event('post')); }.bind(this); } Atkal tas pats, json[1].output.ID eksistē, bet atgriezt nevar. Varbūt kāds izpalīdzēs? Quote
Question
Wuu
TypeError: this.state.ri[k.id] is undefined
A huļi?
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.