parent-child

How to generate an ordered list of parent-child elements from multiple lists?

寵の児 提交于 2019-12-06 05:19:28
I have this problem: Given a number of arrays (for example in Perl, or any other language): 1. (A,B,C) 2. (B,D,E,F) 3. (C,H,G) 4. (G,H) In each array, the first element is the parent, the rest are its children. In this case, element A has two children B and C, and B has three children D, E, and F, etc. I would like to process this set of arrays, and generate a list which contains the correct order. In this case, A is the root element, so comes B and C, then under B is D, E and F, and under C is G and H, and G also has H as children (which means an element can have multiple parent). This should

Remove parentage form child window

 ̄綄美尐妖づ 提交于 2019-12-06 05:19:16
I am dealing with an old developer's site and code. There is a GLOBAL print function the guy wrote that basically senses for any new window that opens (from any method) and "href.match"es the domain name... the script then applies a print stylesheet if need be and fires window.print. This is all done from a global script that is on every page and houses some other functions. I am tired of writing cases for each page added that I want to escape this function. Also if I do write a NOT clause for the certain page, any subsequent page opened within the domain in the child window will then receive

C++ function in parent return child

牧云@^-^@ 提交于 2019-12-06 02:36:35
问题 To be honest, I don't really know, how to ask this question, so please don't be mad :) Anyway, I want to have the mutators (setters) in my class to return this to allow for jQuery-like a.name("something").address("somethingelse"); I have a parent class ( Entity ) and several childclasses ( Client, Agent etc. ). The mutators for most things are inherited from the Entity class (like name or address), but they return an Entity object, so I can't call Client mutators on them. In other words: //

How do you stop children from propagating an event triggered by a live/delegate listener?

拈花ヽ惹草 提交于 2019-12-06 02:19:47
I have a delegation parent that listen for click events in a set of children with a specific class. $(".toggle_group").on("click",".toggle",function(e){ .. }); so heres an example of the html <div class='toggle_group'> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> </div> the problem is that children of a.toggle propogate the event to the

Creating a set number of child objects from a parent's form

 ̄綄美尐妖づ 提交于 2019-12-06 02:02:42
Thanks to Ruby on Rails: How to gather values for child tables from a form? and "Agile Web Dev", I know how to have multiple models in a form using fields_for . But I'm tearing my hair out over this one. Suppose I have a model Person . Person has a name attribute, and has_many :foos . The Foo model, in turn, has a colour attribute. Furthermore, I know that each Person has precisely three Foos . What should my Models, the new and create actions in PersonController , and the new view look like in order to present three nicely-labelled text-entry boxes, one for each Foo and capable of reporting

PHP: Recursively get children of parent

别说谁变了你拦得住时间么 提交于 2019-12-05 21:07:09
I have a function which gets the ids of all children of a parent from my DB. So, if I looked up id 7, it might return an array with 5, 6 and 10. What I then want to do, is recursively find the children of those returned ids, and so on, to the final depth of the children. I have tried to write a function to do this, but I am getting confused about recursion. function getChildren($parent_id) { $tree = Array(); $tree_string; if (!empty($parent_id)) { // getOneLevel() returns a one-dimentional array of child ids $tree = $this->getOneLevel($parent_id); foreach ($tree as $key => $val) { $ids = $this

Why isn't my NHibernate bag collection setting the 'parent id' of the children dynamically?

孤人 提交于 2019-12-05 20:42:18
问题 I have a new object with a collection of new objects within it on some property as an IList. I see through sql profiler two insert queries being executed.. one for the parent, which has the new guid id, and one for the child, however, the foreign-key on the child that references the parent, is an empty guid. Here is my mapping on the parent: <id name="BackerId"> <generator class="guid" /> </id> <property name="Name" /> <property name="PostCardSizeId" /> <property name="ItemNumber" /> <bag

Keep <div> and its children in focus until focus out of <div>

半腔热情 提交于 2019-12-05 20:28:33
I've seen similar topics posted on SO but mine is slightly different. I'm trying to keep my parent DIV (and children) in focus until I focus out of the div, and it seems surprisingly hard to accomplish. This solution I thought would work but it looks to only applies to sibling elements and not the actual div itself. Here's a demo of what I'm trying to do http://jsfiddle.net/nosfan1019/9Eg3k/3/ . I need it so you can click on the gray portion and not have it disappear. Okay, I think that this is what you want: Demo: http://jsfiddle.net/SO_AMK/GNfzw/ HTML: <div> <input type='text'> <span></span>

javascript obtain outer parent id DIV

给你一囗甜甜゛ 提交于 2019-12-05 20:18:27
I have a structure that looks like the one below, I'm trying to get the id foo . It is the only DIV with id if we bubble up from the onclick func() , which means that there wont be other DIVs that contain an id inside foo . However, there can be other tags inside foo that contain an id (such as bye, hello ). No frameworks are being used. <div id="bar"></div> <div id="foo"> <p><p> <div class="bye"> <input id="bye" type="text" value="test" /> <input id="hello" type="text" value="test" /> <table> <tr><td onclick="func(event)">1</td></tr> <tr><td onclick="func(event)">2</td></tr> </table> </div> <

C# usercontrol how to access all child controls

别说谁变了你拦得住时间么 提交于 2019-12-05 17:58:17
I defined a custom panel with a table layout panel inside. However when I used this control on a winform I do not have access to the table layout panel properties. (I want for instance add a column or dock an other control in a cell). I try to changed the modifier property to public, but it still does not work. What can I do in order to see and change the panel layout properties ? In fact, the question can be more generic : how to access/modify/move controls contained in a custom usercontrol ? Thx You need to expose the properties you want to modify in your user control. For example, to change