score:1
It is good idea to store your data into array but not good for those which are having big data.
As you mentioned that on click event you get the new record of the selected state so it is better to store the record in the array as a second key record i mean
array[0] = "Parent record"
array[1] = "Child Record"
array[2] = "Sub Child Record"
So by this you can get record on the spot no need to loop over json now when you come back as you mentioned suppose from state to country than just reload the page by
document.location.reload()
so your array will be initialized with the null values so you can store new values by going to different state no need to get record from country and set because country would be your main page.
Source: stackoverflow.com
Related Query
- How to get parent node from child in json using d3js as Force Layout?
- How to expand child from JSON, load data after click parent - D3.Js - force directed layout
- Can a Child node have multiple Parent nodes in Collapsible Force Layout using D3
- Using D3 loaded with json file, How can get parent nodes value from json file?
- How to get the same node positions in d3's force layout graph
- How to pan to a node using d3's force layout
- d3js Force Directed Graph - Click on node to popup infobox which read from JSON
- how to adjust parent circle radius using d3js pack layout
- Node generation from json data for force layout
- Assigning __data__ from parent node to child with javascript & d3js
- How to get common child node in D3.js Force-based Labeled Layout Graph
- Parent child JSON from CSV using Python sunburst
- How to update a data of a node in d3 force layout using react
- How to get the count of "Message" and distinct count of "name" from json using javascript?
- how to make child nodes of tree layout collapsing into parent node when clicked
- how to import php script that convert mysql data to json format, from d3.json function in force directed layout
- How to get data of parent node in d3.js
- How do I create a tree layout using JSON data in d3.v4 - without stratify()
- How can I show a graph using d3 force layout with initial positions set and no movement at all?
- How to display a text when mouseover a node in D3 force layout
- Center force directed layout after tick using root node (return to center)
- How can I connect two parent node into one child node and how to make a tooltip for each node in the tree pragmatically? in D3 js (SVG)
- How to assign the x-axis position of a node in a Sankey Diagram (D3) from the json file
- reading nodes and edges from two distinct csv files using Force Layout
- How to get started with d3js examples using xampp?
- How do I use d3.domain to get d3.min and d3.max from multiple columns in a JSON file?
- How to get value from the element using selection in d3
- How to get web element (id) from the element position in D3.js force graph
- D3 Force Layout : How to force a group of node to stay in a given area
- d3js force layout dynamically adding image or circle for each node
More Query from same tag
- d3js diagonal paths in tree layout don't look right
- Bounding the d3.js force directed graph
- Integrating d3 with a custom angular directive
- D3.js network only move once (using tutorial codes)
- d3.nest() key and values conversion to name and children
- How do I draw a percentage from baseline?
- Add a title to C3.js chart legend
- jQuery parallel d3 objects
- Inserting new line in .html() using D3
- Reactjs with D3js treemap
- D3: "SVG4601: SVG Path data has incorrect format and could not be completely parsed."
- D3 line graph show positive and negative numbers
- d3.js - Query regarding interpolate values
- D3JS SVG Viewbox Attribute
- How to change the viewfinder (focus chart) of a NVD3 line chart programmatically?
- NVD3 tooltip only shows category
- Line chart color with D3 wrapper
- How to add custom conditional colors in D3 tree nodes?
- Adding drop shadow effects in d3.js circle
- Programmatically opening d3.js v4 collapsible tree nodes?
- Uncaught TypeError: .filter is not a function
- What does zoom.scaleExtent() do in d3.js?
- Composing D3 charts (pie) in Tree
- Error when loading .json/.csv in
- d3.js:vertical moving line's intersection point with two line graph
- How to create bar chart with path property in d3js?
- D3.js treemap cells overlap with each other
- In R plotly d3js how to format a number with space instead of comma?
- Javascript object sort and slice
- How to reset d3 graph to its original place?