javascript - rendering tree view from json callback -
json callback returns me formatted dates , it. basing on given dates have build tree structure, seperate different years, months , days. oonly dates obtained in callback included in tree.
i've write below on servicesucceedcallback:
var daty = ''; var roczniki = ''; var miesiace = ''; var dni = ''; (var in result.content) { roczniki += '<ol id="lata">' + result.content[i].getfullyear() + '</ol>'; miesiace += '<ol id="miesiace"><li>' + (result.content[i].getmonth() + 1) + '</li></ol>'; dni += '<ol id="dni"><li>' + result.content[i].getdate() + '</li></ol>'; } var $st = $('#toolleft'); $st.append(roczniki); $('#lata').append(miesiace); $('#miesiace').append(dni); it gaves tree view, every date written first node (first found year) , second problem have no idea how ommit duplication of datas. mean, if year has place in tree, date same year should go same node level, no create new one....
it gaves tree view, every date written first node
use json.stringify build dom, in question:
javascript: using reviver function, seem can't alter keys, while concating numbers
if year has place in tree, date same year should go same node level, no create new one
use loop insert each date key of object literal, such foo, use json.parse remove duplicate keys. here example:
var foo = {"2000-01-01":"good", "2001-09-11":"bad", "2000-11-02":"ugly", "2000-01-01":"jetson"} var bar = json.parse(json.stringify(foo) ) var baz = json.stringify(bar)
Comments
Post a Comment