mrself / symfony-tree-form-type Goto Github PK
View Code? Open in Web Editor NEWSymfony 4 tree from type based on JsTree plugin.
License: MIT License
Symfony 4 tree from type based on JsTree plugin.
License: MIT License
It may be useful so some other nodes (dependencies) are selected on the main node select.
For example, there are such nodes:
And when a user clicks Primary Node, all other dependencies are auto-selected.
A new option dependencies
will be added to the form type, where keys are node ids and values are the ids of node dependencies.
For example, I can open a form, unselect (uncheck) a tree item and then save the form. But when I open the same form again, I will see that the unselected tree item is selected again.
The initialization of associations is performed on ready.jstee
event. However, at that time some nodes may be closed. It means, that there may be no nodes with association found though they may exist in jstree data option. It is suggested to initialize associations when a node is opened.
Currently, associations can be set only for a specific node #1 and not in batch. However, it may be quite useful to use a separate option for associations. The necessary option object will have a node id as a key and associations array as a value:
{
associations: {
'conditionNodeId': ['associationNodeId1', 'associationNodeId2']
}
// ... rest options
}
id_prefix
is not passed to view with corresponding ID. It works in reverse transform though: it removes id_prefix
from tree item IDs.
Suppose, there is a tree node which should select select other nodes on click. But not always, a web user will choose if it is necessary so those associations will be selected. In other words, provide a button for a user which will trigger select for other nodes.
The implementation will look like this:
Such button is inserted to the node html at the moment of generating the data for jstree. For example:
$tree = [
// ... required properties
'text => "My node <span data-association-trigger>Select associations</span>"
]
The button in this case is represented with the span
tag. Actually, it does not matter. We can not use a
tag because jstree already places the text in a
tag. In any case, a "click" event will be bound to the trigger element directly.
There may be situations when a tree node with the same id exists in multiple folders. In this case, all of the tree nodes with the same need to have select/unselect events in sync.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.