Hello All
I want to add data to the data source of igtree using a for loop
My nodes are gonna be Well #1, Well #2 and their child being Stage #1, Stage #2 and so one so forth.
Can anyone help me include a for loop in the following format:
var data = [ { "Text": "xyz", "Value": "1", "Wells": [ { "Text": "Well #1", "Value": "11", "Stages": [ { "Text": "Stage #1", "Value": "111" }, { "Text": "Stage #2", "Value": "112"}] }, { "Text": "Well #2", "Value": "12", "Stages": [ { "Text": "Stage #1", "Price": "121" }, { "Text": "Stage #2", "Price": "122"}] } ] }];
Hello Aditya,
Do you still require assistance with adding data to the data source? If so, please provide more detail about what you want to implement and how based off of the questions that Troy provided above. Please let me know if I may be of any other assistance in the meantime.
Hi Aditya,
Can you give me a macro-level description of what you are trying to accomplish. I mean are you just looking to add nodes to the tree and various levels? If yes, are the nodes to be added in anyway user defined? Or defined programmatically? If defined programmatically, is there any user action that triggers the dynamic creation of the nodes?
Here you are wanting to loop through and add to the data source. What is the reason that you want to add to data source by using a loop? What is the reason for this approach?
I am not clear on what you mean you say you want add a "variable number of events" when adding stages to the json. How are you seeing events to be added? Adding an event to the control definition I can see but I am not following this in context to the json data.
How are callbacks needing to be used in the context of adding data (nodes) to the data source? Can you give an example? Are you using something like NodeJS for callbacks?
If you can include a small sample that I can run on my side that will be considerably helpful.
Please let me know the answers to the above as these answers will provide some clarity for me. Thanks!
Hello Troy:
I basically wish to add x number of stages and variable number of events under each of them. Also I would like to plot them using callback.
Will value and name be enough for callback?
Could you suggest me a callback example too?
Thanks,
Aditya.
Is your objective to add nodes to the igTree data source? If yes, these forum posts discusses this and perhaps will help you to address this: http://ko.infragistics.com/community/forums/t/64875.aspx AND http://ko.infragistics.com/community/forums/t/65356.aspx
Or, is your object to mainly add Name: Value pairs to your json? If so, there are a few posts on Stack Overflow that may help. This one for example: http://stackoverflow.com/questions/7255058/how-to-loop-through-add-pairs-of-values-to-json-object
If neither, can you provide some context to understand your overall objective? Including a small sample also can help to see what you are needing to do. Thanks!