Skip to content

Commit

Permalink
A special method for easily accessing the underlying treeview instance
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmiles committed Mar 22, 2015
1 parent f3c3729 commit a87405b
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 16 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,36 @@ Whether or not to display tags to the right of each node. The values of which m

## Methods

Methods provide a way of interacting with the plugin programmatically. For example, expanding a node is possible via the expandNode method.

You can invoke methods in one of two ways, using either:

#### 1. The plugin's wrapper

The plugin's wrapper works as a proxy for accessing the underlying methods.

```javascript
$('#tree').treeview('methodName', args)
```
> Limitation, multiple arguments must be passed as an array of arguments.
#### 2. The treeview directly

You can get an instance of the treeview using one of the two following methods.

```javascript
// This special method returns an instance of the treeview.
$('#tree').treeview(true)
.methodName(args);

// The instance is also saved in the DOM elements data, and accessible using the plugin's id 'treeview'.
$('#tree').data('treeview')
.methodName(args);
```
> A better approach, if you plan a lot of interaction.
The following is a list of all available methods, enjoy!

### clearSearch()

Clear the tree view of any previous search results e.g. remove their highlighted state.
Expand Down
Loading

0 comments on commit a87405b

Please sign in to comment.