I've created an extJs drag and drop tree and I'm attemting to check whether a node exists in a particular branch before it's dropped in. To do this, I'm overwriting a method called beforeDragDrop() (Link), which passes in the whole Target tree, the Event object, and the Dragged item ID.
Calling Event.getTarget() gives me the the target node of the item adjacent to the dropped item. What I really need is the parent node within the target where this item is dropped, which will allow me to check whether the item already exists within the branch.
Is there any way of getting the id of a Tree branch within the drop target in ExtJs?
It's a long shot, but I've been faffing around for ages and could really do with a hand.
Thanks!
Is there a parent() method for the target node? What kind of object does getTarget() return?
var dropposition = tree.getdropPositonModel().getdropPosition();
// put it on AJAX require
params :
{
dropid : dropposition.data.id // id from getNodes
}
Related
Using ARKit, I have a use case where I need, from a touch event to retrieve the touched Node, and update it with some of its Anchor information.
With ARKit, I can retrieve the touched anchor, but then, how to get the related node ?
or
With SceneKit, I can retrieve the touched node, but then, how to get the related anchor ?
The only I found was to maintain a relationship table myself, using the various delegate's calls. Is there any smarter way ?
The ARSCNView class exposes both -anchorForNode: and -nodeForAnchor:.
How to get the current object id in Admin::configureListFields?
$this->getSubject() returns null
Thank you
Since there are many objects in a list, your question makes no sense. I'll go ahead and assume you are in a child admin. If this is the case, I think you are looking for $this->getParent()->getSubject()->getId()
Based on the way you've phrased your question I assume you ran into the same issue as I did.
My assumption is thus: You are looking to use configureListFields to manipulate the content of the rows of the list / the "current" element.
As greg0rie pointed out - there is a misconception here in that there is no "current" element.
Specifically - configureListFields s called before the list is iterated for output so no current element exists.
Furthermore, as far as I can tell there is no method we can overwrite that is called specifically when the list is iterated over.
Therefore, what I ended up doing is the following:
First overwrite the twig template of whatever you're wanting to change in the list.
Then create a Twig extension function and pass in the "admin" and "object" properties that should be available at template level at this point:
{{ myTwigFunction(admin, object) }}
admin is the instance of the sonata admin rendering the list.
object is the current template.
Therefore, you now have access to the current entity object as well as the sonata admin that's handling it.
Personally I then passed this into a service to generate the changes I wanted to make.
I have a treestore in which all nodes have the initial config checked:false , so that a checkbox will appear, allowing the user to check items in the treepanel. I then get the checked items from the treestore and move them to another treestore, in another tree panel. My question is how do I, when moving the node, make sure it is not checked in the treepanel it is moved to?
Here's what I have done:
I have gotten a reference to the node I am moving(adding to one store, removing from the other), and I have set it's config checked:false. When I view the node in firebug after it is within the new treestore, sure enough, checked:false, which is what I wanted, however, within the panel, visually, it is still checked. So How do I make it uncheck??
There are a couple of reasons why this could be happening.
The dataIndex of the new column does not match the dataIndex of the old column(in the case of using a treegrid)
Your model assigned to both stores is not the same Ext.data.Model in both cases.
I have noticed some weirdness with treenodes and attributes not working if you don't specifically add that config option to your Ext.data.Model. So try assigning the same model to both trees with "checked" as one of the fields with dataType: "boolean"
I had the same problem last week.
I made this kind of operations last week to solve it:
currentNode.data.checked = false;
currentNode.raw.checked = false ;
currentNode.triggerUIUpdate();
It seems it didn't work without the triggerUIUpdate. I am working with extjs4.2.1
In our project we use ZK for webpages. There is a combobox which has lists. When selected, it fetches data from a java object through onSelect, i have given the logic.
when i select one there are 4 listboxes on that page to be filled with data according to the selection. when i select first time, no problem occurs.
But on second time i get an error pop-up like "Not Unique in the id space of Window" and showing the list box item id which have to be filled on select.
Can any one help out there?
Note: Though it shows this error i get the listboxes filled correctly according to the combo box selection. Still i cant stop this error occurring..
Your issue is a conflict of ids in ZK's id space.
A bit of background..
ZK generates ids for components at runtime, if you open up the DOM in the browser you'll see each component has some machine readable id.
However, you can also give components an id. This id does not go to the DOM but lets you reference the component in your application.
These two shouldn't be confused. The conflict you're experiencing is with the latter type of id; you are assigning a component an id in your Java code or in your ZUL file which, at runtime, is not unique.
The case you describe where it only happens the second time you click is a tell tale sign here. The content you are adding on the event has an id defined in it and you are not removing this content when you are done.
Consider the following example:
#Wire
private Window myWindow;
#Listen(Events.ON_CLICK + " = #myButton")
public void onMyButtonClicked() {
Label myLabel = new Label("sean is cool");
myLabel.setId("myLabel");
myLabel.setParent(myWindow);
}
This will work the first time you click myButton, but will throw your error on the second click. That is because the second event tries to add myLabel to myWindow but there is already a myLabel there.
There are lots of ways to resolve this depending on what you are trying to do.
Have a look through the ZK documentation on ID Spaces for more.
I also faced the same error.
My scenario is the same, only the widgets being used are different.
Hence putting my workaround here.
I have put the following piece of code in the doBeforeCompose() method of the composer:
Component widgetWithId = page.getFellowIfAny("widgetWithId");
if (widgetWithId != null) {
widgetWithId.detach();
}
Here widgetWithId is the component/widget, which is tried to be regenerated by the code, with the same Id and ZK is throwing error for it.
Please consider the situation:
I'm using Extjs' tree.Panel to have some sort of navigation on a page.
I have a list of items in another portion of the page, whose list items have a unique id that matches the internalId of a node in the tree.
I wish to bind a click for each list item and expand the tree to the node specified by the id on the item.
I intend to use the expandPath(path) method from the tree. My question would be: how can I get the path string with just the internalId? Thank you.
Unfortunately function NodeInterface.getPath was vanished from extjs4. So there is no way to use expandPath(path). But, instead, you can use
tree.store.getNodeById('ext-record-23').bubble(function(node){node.expand()});