PDA

View Full Version : tree panel using store from ajax json response



y0uzha
6 Mar 2015, 12:44 AM
hi, i'm just trying to make tree panel and i want to use the ajax json response to be the store.
this is my example ajax response :


[{
"_id": "54eeaadd6f949f0239a38830",
"name": "baruSaja1.csd",
"project": "nkjn"
}, {
"_id": "54eec785c28967a44d1b033e",
"name": "baruSaja2.csd",
"project": "kjhiub"
}]


how if i want to use value from the "project" property to be children of my tree panel. ? from the examples that i've got. all json that use to store are have property "children" and "leaf". so i confuse how if i want to use my json response above. please help me :)

yeghikyan
6 Mar 2015, 2:43 AM
You can use this ugly code: https://fiddle.sencha.com/fiddle/j8g
But do not do it, better change your backend. :D

y0uzha
7 Mar 2015, 9:21 AM
hi thx for your reply. can you explain to me why i better don't use this way to my tree panel.?

yeghikyan
7 Mar 2015, 9:54 AM
KISS is an acronym for "Keep it simple, stupid" as a design principle noted by the U.S. Navy in 1960. The KISS principle states that most systems work best if they are kept simple rather than made complicated; therefore simplicity should be a key goal in design and unnecessary complexity should be avoided.
http://http://en.m.wikipedia.org/wiki/KISS_principle (http://en.m.wikipedia.org/wiki/KISS_principle)
:-|

y0uzha
7 Mar 2015, 10:01 AM
wow thx for your explanation. it really helpfull ;)