I'm confronted with the following not-knowing-how-to-do-this:
Two content types (CT) : Parent and Child
Parent has a field ChildRef (Field type: Entity Reference; Widget: Select list)
Child has fields Name (Text) , Adress(Text) and so on
When I create a new Parent node, I can select one of the Child nodes (no problem there, the Select list nicely displays the titles of the Child nodes)
What I need is that while editing the Parent, I'd like to preVIEW (no editing there) the fields of the Child, displayed inline, below the Select list.
Of course, once the Parent node is saved, there are many ways to display the Child node inside the Parent node. But it's the preVIEW in the Parent's edit mode that I need.
Try the Entity Reference View Widget
Then in the child content type, manage the display of fields for the widget.
Related
I'm using Javascript to dynamically create a QML component via:
var component = Qt.createComponent(qmlURL)
var item = component.createObject(parentLayout, properties)
In this case, the parentLayout is a ColumnLayout and it always creates the object at the end of the children list (which means it is displayed at the bottom of the column).
How can I specify the index position within the children of where the object is placed, or how can I move it in the children list post instantiation?
(I tried assigning parentLayout.children[i] to no avail)
Use case: I have a large existing multi-level (nested) Menu system that is static, but I'd like insert and remove custom submenu items in the hierarchy in response to external plugins registering/unregistering via a service API. While we could completely re-implement the menu system as a dynamic treeview, that seems overkill just to insert a couple menu subitems dynamically.
Hello everyone.
I have a tree of items as shown on image above (Items tree).
I need to display this tree in a way that is shown on an image (Views).
It has two views, Tree View and List view. Tree view should display the whole tree of items, and list view should display properties for a selected item in a tree view. (On an image it displays properties for a cat item)
The way it is implemented right now is displayed at "Current implementation" part of an image. TreeModel contains item tree, and when you click on an item in a TreeView, current item is sent to a ListModel to display it's properties.
The issue thagt i encounter here is that in both views items are editable. In a tree view you can edit item's names, and this change should appear in a list view as well. The same goes for opposite direction. Changing name of a Cat item should reflect on a treeView cat item.
Since it is two different models, the change is made only when you hover over another view.
What i currently did is for a changed item in one of views, i search for a item in a another view via QModelIndex::match() and then just update that part of a view via emit dataChanged(). I am not sure this a good way. So if maybe you can give me some ideas on how this can be done better.
Thank you.
You should have only one model. The QAbstractItemView::setRootIndex method is all you need: you can set the current item in the tree as the root for the table view. Alternatively, you could use a proxy viewmodel to adapt the data for display in a particular form.
I have three TextArea that are all children of an HBox and I have selected one of them. I was wondering if there was a function for selecting the next child.
I tried to use a for loop of the parent node but I couldn't find a way to select a specific TextArea that was the next child of the one I already selected.
// if you don't already have the index of the text field in its parent do:
int index = textField.getParent().getChildrenUnmodifiable().indexOf(textField);
// then
Node next = textField.getParent().getChildrenUnmodifiable().get(index+1);
Note though that in any typical setup, you won't really need these, as you would only have access to the text field within the same scope that you essentially added them to the parent. So you would "know" which text field followed which.
I have populated my trieview and on clicking the parent node, i could load the relevant content on the page.
In my case, Parent node is name of the article and child nodes are sections of article.
On clicking the section of article (child node), i need to bring that section on top of the page.
by using like,
I tried to provide this anchor as my child node value,
node.value = "
Now on clicking the child node, it does a postback, instead of bringing the section to top of the page.
How can i achieve this ?
Trick is to add
"
In the Node.Name property
Use following :
<a name="Section_top"></a>
I have a vocabulary displayed as checklist that has both parent and child terms like:
Parent 1
Child1.1
Child1.2
Parent 2
Child2.1
Child2.2
Child2.3
My requirement is to have the parent term disabled by default. In case user selects any of the child term, the parent gets automatically selected.
Suggestions?
You can modify the value of the reference field on save. If node entity use hook_node_presave().
First get the original tid & load it using taxonomy_term_load() to get term object, get parent id from that and replace it in the reference field.
The Term Reference Tree Widget Module provides a nice interface for selecting terms and gives an options to select the parent term when selecting the child.