jPut
jPut copied to clipboard
Duplicate data in demo\mult-jput with second group
I have a situation with similar data to this demo where jRepeat of person data is being duplicated (appended) in the first list from the second location. I simply duplicated the first group (name:green) and made a second group (name:yellow). When I run the demo with an array of groups everything looks good except the nested person data from group.name.yellow gets pushed into group.name.green??
jPut-master/demo/multi_jput\data.json (index.html wasn't changed): { "group": [ { "name": "green", "location": [ { "lname": "houston1", "id": "h1", "person": [ { "pname": "person1", "moid": "p1" }, { "pname": "person2", "moid": "p2" }, { "pname": "person3", "moid": "p3" } ] }, { "lname": "houston2", "id": "h2", "person": [ { "pname": "person4", "moid": "p4" }, { "pname": "person5", "moid": "p5" } ] } ] }, { "name": "yellow", "location": [ { "lname": "houston3", "id": "h1", "person": [ { "pname": "person1", "moid": "py1" }, { "pname": "person2", "moid": "py2" }, { "pname": "person3", "moid": "py3" } ] }, { "lname": "houston4", "id": "h2", "person": [ { "pname": "person4", "moid": "py4" }, { "pname": "person5", "moid": "py5" } ] } ] } ] }
WebBrowser view:
List groups
•
• •
•
•green ◦Location Name :houston1 ◦ID :h1 ◾Person p1 ◾Person p2 ◾Person p3 ◾Person py1 ◾Person py2 ◾Person py3 ◦Location Name :houston2 ◦ID :h2 ◾Person p4 ◾Person p5 ◾Person py1 ◾Person py2 ◾Person py3 ◾Person py4 ◾Person py5
•yellow ◦Location Name :houston3 ◦ID :h1 ◾Person py1 ◾Person py2 ◾Person py3 ◦Location Name :houston4 ◦ID :h2 ◾Person py4 ◾Person py5
Is there a way I can prevent this replicated data in group.green.person data?
Hi, I am not able figure out your exact issue. So can you put the code in https://jsfiddle.net/ and share to me.
Tips which can help you : Dont put template inside template. Keep it separated. (http://shabeer-ali-m.github.io/jPut/v2demo/loop_inside_loop/)
Hi, I am not able to print array inside the object....Please help me out from this problem
"DeviceState": { "name": "DeviceState", "values": [ { "name": "disconnected", "lifetime": { "added": { "version": { "major": 1, "minor": 0 } }, "deprecated": { "version": { "major": 1, "minor": 2 }, "removed": { "version": { "major": 1, "minor": 6 } } } }, { "name": "connected", "lifetime": { "added": { "version": { "major": 1, "minor": 0 } }, "deprecated": { "version": { "major": 1, "minor": 6 }, "removed": { "version": { "major": 1, "minor": 8 } } } } ] }