cos-archives / hgrid

[UNMAINTAINED] A Javascript-based hierarchical grid that can be used to manage and organize file/folder-like data
Apache License 2.0
23 stars 14 forks source link

Store `path` property on each node #57

Open sloria opened 10 years ago

sloria commented 10 years ago

Besides the fact that this will eventually be needed for certain OSF features (e.g. pointers, S3 addon), this would be a useful feature to have

sloria commented 10 years ago

To be more clear:

var root = new HGrid.Tree();
var tree = new HGrid.Tree({name: 'My Docs', kind: 'folder'});
var leaf = new HGrid.Leaf({name: 'foo.txt', kind: 'item'});
root.add(tree);
tree.add(leaf);
console.log(leaf.path);
// => ["My Docs", "foo.txt"]

path might also be an Array of IDs instead of names.