tree-structure

Sencha Touch 2: Insert into TreeStore/NestedList

若如初见. 提交于 2019-12-05 08:09:16
I'm using a NestedList with a underlying TreeStore. Now I want to add items to the NestedList as leafs. How can I do this? Currently my code (Controller, onAddButtonTapped) looks like this: var store = Ext.getStore('menuStore'); var customerAreaNode = store.getRoot().getChildAt(1); customerAreaNode.appendChild({name: "text", leaf:true}); customerAreaNode.expand(); store.sync(); This code results in two new empty listentries on leaf level (behind the correct node) and one new listentry on node level. Every new entry has no names shown in the NestedList but every item contains "text" in their

Recursive search on a collection in MongoDB

旧城冷巷雨未停 提交于 2019-11-29 09:25:45
I have a list of documents in MongoDB with tree structure, where Model Tree Structures with Parent References pattern used. I want a single aggregation query which returns ancestor list(till the root), given the 'name' property. Structure: { '_id': '1', 'name': 'A', 'parent': '', }, { '_id': '2', 'name': 'B', 'parent': 'A', }, { '_id': '3', 'name': 'C', 'parent': 'B', }, { '_id': '4', 'name': 'D', 'parent': 'C', } Aggregation result:(Given, name = 'D') { '_id': '4', 'name': 'D', 'ancestors': [{name:'C'}, {name:'B'}, {name:'A'}] } Note: I can't change the document structure now. It will cause

How to store directory / hierarchy / tree structure in the database?

ぐ巨炮叔叔 提交于 2019-11-27 06:35:53
How do i store a directory / hierarchy / tree structure in the database? Namely MSSQL Server. @olavk: Doesn't look like you've seen my own answer. The way i use is way better than recursive queries :) p.p.s. This is the way to go! There are many ways to store hierarchies in SQL databases. Which one to choose depends on which DBMS product you use, and how the data will be used. As you have used the MSSQL2005 tag, I think you should start considering the "Adjacency List" model; if you find that it doesn't perform well for your application, then have a look at Vadim Tropashko's comparison which

MongoDB $graphLookup get children all levels deep - nested result

耗尽温柔 提交于 2019-11-26 17:23:40
问题 As presented in https://www.slideshare.net/mongodb/webinar-working-with-graph-data-in-mongodb, slide 50 it is possible to use $graphLookup on a View in order to get a 2 levels deep tree-structure in nested format . I have a MongoDB collection with tree nodes as documents with the following format: { "_id" : { "$oid" : "5b1a952361c6fa3418a15660" }, "nodeId" : 23978995, "name" : "settings", "type" : "Node", "parentId" : [ 23978893, 23979072, 23979081 ] } I have created a View like: db

How to store directory / hierarchy / tree structure in the database?

烂漫一生 提交于 2019-11-26 12:04:59
问题 How do i store a directory / hierarchy / tree structure in the database? Namely MSSQL Server. @olavk: Doesn\'t look like you\'ve seen my own answer. The way i use is way better than recursive queries :) p.p.s. This is the way to go! 回答1: There are many ways to store hierarchies in SQL databases. Which one to choose depends on which DBMS product you use, and how the data will be used. As you have used the MSSQL2005 tag, I think you should start considering the "Adjacency List" model; if you

Optimized SQL for tree structures

拜拜、爱过 提交于 2019-11-26 09:18:07
问题 How would you get tree-structured data from a database with the best performance? For example, say you have a folder-hierarchy in a database. Where the folder-database-row has ID , Name and ParentID columns. Would you use a special algorithm to get all the data at once, minimizing the amount of database-calls and process it in code? Or would you use do many calls to the database and sort of get the structure done from the database directly? Maybe there are different answers based on x amount