use random ids for data tree list items

This commit is contained in:
rolux 2011-07-26 16:33:52 +02:00
parent 719ffc050a
commit 57ae6e5c64

View file

@ -137,14 +137,14 @@ Ox.TreeList = function(options, self) {
function parseData(key, value) { function parseData(key, value) {
//Ox.print('parseData', key, value) //Ox.print('parseData', key, value)
var ret = { var ret = {
id: key, id: Ox.uid(),
title: key.toString().split('.').pop() title: key.toString()
}, },
type = Ox.typeOf(value); type = Ox.typeOf(value);
if (type == 'array' || type == 'object') { if (type == 'array' || type == 'object') {
ret.title += ': ' + Ox.toTitleCase(Ox.typeOf(value)); ret.title += ': ' + Ox.toTitleCase(type);
ret.items = Ox.map(Ox.sort(Ox.keys(value)), function(k) { ret.items = Ox.map(Ox.sort(Ox.keys(value)), function(k) {
return parseData(key + '.' + k, value[k]); return parseData(k, value[k]);
}); });
} else { } else {
ret.title += ': ' + ( ret.title += ': ' + (