I want to add a dimension to my multidimensional array called description. The objective is to go through the array, count the children and add a "parent" dimension based on the number of elements existing in description. But i'm currently stuck trying to append information into my array. I want to add this "parent" dimension, or at least be able to put a string into the location description[x]["TimeSeries"]["parent"]. Any help on how to proceed?
(function () {
var description;
description = {
1: {
source: "http://beat.entrayn.com/render?width=550&from=-2hours&until=-&height=570&colorList=FFFFFF%2C%20BBBBBB&target=*.entraynec2_ldb01.load.load5&target=*.entraynec2_ldb01.load.load1&title=DB%20EC2%20Load&_uniq=0.9870549130719155&format=json",
TimeSeries: {
//parent: "#hero-three",
title: "Clients Installed"
}
},
2: {
source: "http://beat.entrayn.com/render?width=550&from=-2hours&until=-&height=570&colorList=FFFFFF%2C%20BBBBBB&target=*.entraynec2_ldb01.load.load5&target=*.entraynec2_ldb01.load.load1&title=DB%20EC2%20Load&_uniq=0.9870549130719155&format=json",
TimeSeries: {
//parent: '#g2-1'
}
},
3: {
source: "http://beat.entrayn.com/render?width=550&from=-2hours&until=-&height=570&colorList=FFFFFF%2C%20BBBBBB&target=*.entraynec2_ldb01.load.load5&target=*.entraynec2_ldb01.load.load1&title=DB%20EC2%20Load&_uniq=0.9870549130719155&format=json",
TimeSeries: {
//parent:
}
}
};
$(description[3]["TimeSeries"]["parent"]).append('g2-2');
var g = new Graphene;
g.build(description);
alert(description[3]["TimeSeries"]["parent"]);
}).call(this);
[]not{}.append(...)of nonexistent object lying underdescription[3]["TimeSeries"]["parent"]. In factTimeSeriesobject doesn't have keyparentyet. I assume you expect string'g2-2'to be appended to an array lying under indexparent. From your description: 'add a "parent" dimension based on the number of elements existing indescription'. So tell us, what is the relation between'g2-2'and the number of elements existing indescription?