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()});
Related
Im using final-form/react-final-form-arrays library is there a way to sort by most recent field appearing first. The FieldArray component has the fields prop which is array like but does not have a reverse function. So each time I add a new field e.g fields.push({newObject}) I want that rendered component to be at the top of the list. Anyone know how to make this work?
Yes, there is a way to add values to the top instead of the bottom.
Simply replace
fields.push({});
with
fields.unshift({});
More details can also be found in the root readme: https://github.com/final-form/react-final-form-arrays
Currently my requirement is to check the check box at class="ui-checkbox seyc-cell-checkBox-div".
The input which I have is the supplier description present at id="cellDocument2_matrix_block_0_1"
Could you please let me know how to create a Xpath for selecting the check box using the text
"../" will take you one level up. So for example, you are on certain element and you want to navigate 3 levels up in hierarchy you would have to do element.FindElement(By.xpath(../../..));
Found an xpath :
$x("//*[contains(text(),'description')]//ancestor::a/div/div[1]")
Do let me know, incase of any other better approach for location checkbox
I have a Drupal 7 question. I would like to display certain pieces of information from my current node using a view.
I can use views to display information from other nodes easily by setting filters and other sorting features. That's no problem. However, I want to display information from the node which is currently opened. So, for example, if I'm on a page (node: 117, title: news), I can display all the images from that page, plus captions, by creating a view.
The logic, I suppose, would be to create a view with a filter (or contextual filter) stating that the node has to equal the current node, but I don't know how to do that.
Does anyone have any advice? How do I instruct a view to display information from the node which is currently open?
Thanks!
Edit the view
Add Content: Nid in contextual filter
In contextual filter options
WHEN THE FILTER VALUE IS NOT AVAILABLE
Select "Provide default value"
Type: Content ID from URL
Now the default argument will be the nid of the current node.
I have two models:
Book
Category
I have two views:
books/browse
In this view there is paginated list of books, with sort options, book language select, author/title filters and so on. One thing there isn't - book category tree. In fact this controller takes as a parameter category_id and displays only books from this category.
categories/tree
This view (controller) finds the category tree and it takes one parameter -> category_id -> to determine how to print the tree (to show all parent nodes, and parents list and so on).
Now I need a view (for example browsetree) where there is category tree on the left and a list of books (with all stuff) on the right.
What will be best solution to accomplish this? (The problem is also I want to be able to save the link to book browse view with all it's params (category_id param + sorting + few GET params for filtering) and I also don't want to rewrite any view or controller method...
-------------- edit
Okay I have my tree in element
categorytree
and it looks like this:
$params = $this->requestAction('/categories/tree/'.$category_id);
print_category($params['tree'][0],$params['parents'],$category_id);
The $category_id is passed to the element as parameter.
This is inside /books/browse:
<?php echo $this->element('categorytree', array("category_id" => $category_id)); ?>
What I need is that in categorytree element I want that each tree node was a valid link to /books/browse based on current url that books/browse is loaded from.
I mean that the url might be:
books/browse/34/sort:asc/page:4?author=Author&something=something
I could get this link
inside /books/browse/...
view and pass it to the element and then parse it to replace /34/ (it's category id) with other categories... But is there any easier / more elegant way of doing this?
Put your category tree in an element and use CakePHP's requestAction to get it's data from the Category controller.
You can keep your tree view in the Books area (which makes sense, since that's what the user is browsing) - up to you which view you put it in.
Bottom line, the user is searching books, so that's where the view and the code should be. Use the Category tree to just pass a variable for which category you want to use in your query against the books.
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
}