03-11-2018 20:38 - edited 03-11-2018 20:39
03-11-2018 20:38 - edited 03-11-2018 20:39
Trying to parse return result from Select that includes TextImageRow render. Used JSON.stringify(evt) to produce return result. {"data":{"key":"emblem","newValue":"{\"selected\":[0],\"values\":[{\"id\":\"0\",\"image\":\"my-image-end.png\",\"name\":\"Fleet\"}]}"}} I am needing the Id from the values of the selected newValue.
Answered! Go to the Best Answer.
03-19-2018 23:25
03-19-2018 23:25
newValue contains a JSON string, so you need to JSON.parse(evt.data.newValue) before trying to access its values.
03-19-2018 23:25
03-19-2018 23:25
newValue contains a JSON string, so you need to JSON.parse(evt.data.newValue) before trying to access its values.
03-20-2018 06:29
03-20-2018 06:29
I ended up using the below after several attempts to get the id field value from:
{"data":{"key":"emblem","newValue":"{\"selected\":[0],\"values\":[{\"id\":\"0\",\"image\":\"my-image-end.png\",\"name\":\"Fleet\"}]}"}}
let data = JSON.parse(evt.data.newValue);
result = data['values'][0]['id'];