Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement of JsTree 3 themes and plugins support #49

Conversation

flofourcade
Copy link
Contributor

  • add support for other plugins provided by jstree (search, sort, massload, ... ) via a new plugins attribute in <sjt:tree />.
    It expects an JSON formatted string with key -> plugin name and value -> the config object for the plugin
    (eg plugins="{search:{ajax:false}} to enable jstree search plugin without AJAX.)
    Be careful, you can override here configuration of plugins already defined with other tag attributes (checkbox, contextmenu...). This behaviour can be easily altered by a little change in jquery.tree.struts2.js
  • add support for JsTree 3 theme "Variant" and "Responsive".
    Some JsTree 3 themes now support variant (eg "large") and responsive mode.
    You can configure this with the new jstreethemeVariant="variant_name" and jstreethemeResponsive="boolean" attributes.

this attribute allow to enable jstree plugins like search, sort, dnd,
massload,...
- add examples in showcase for search plugin with/without ajax usage
- add example for themeVariant and responsive usage
@flofourcade flofourcade changed the title Release/4.0.1 jstree improv Improvement of JsTree 3 themes and plugins support Jul 15, 2016
@jogep jogep merged commit 3ace8b6 into struts-community-plugins:release/4.0.1 Jul 20, 2016
@jogep jogep added this to the 4.0.1 milestone Jul 20, 2016
@jogep jogep self-assigned this Jul 20, 2016
@jogep
Copy link
Contributor

jogep commented Jul 20, 2016

@flofourcade thank you for this valuable contribution! It is merged now in the 4.0.1 branch.

@jogep
Copy link
Contributor

jogep commented Jul 20, 2016

Does this search feature work for you? When I click on search nothing happens.

@flofourcade
Copy link
Contributor Author

Yes it works. On the non AJAX example, if you type twitter, the node Struts @ Twitter must be highlighted and all his parent nodes opened.
Same behaviour expected for the AJAX search feature.
Maybe I have missed something in my commit. Are there errors in the browser console ?

@flofourcade
Copy link
Contributor Author

Search works but I have a JS error, even if it does not block the search for me.
I used <sj:submit /> without form instead of <sj:a />, which would be cleaner.
Have to replace

<sj:submit value="Search" button="true" 
    onclick="$('#treeSearch').jstree('search', $('#searchField').val())" />

by

<sj:a onclick="$('#treeSearch').jstree('search', $('#searchField').val())" button="true" >Search</sj:a>

in tree.jsp and tree-json.jsp.
Over used Copy / Paste !

@jogep
Copy link
Contributor

jogep commented Jul 20, 2016

What you think about using two new attributes on the jstree component?

searchTopic = Define a topic which triggers the search
searchElementId = ID of the search element

Then we don't need a onClick with code we just need to define a topic which can be published by any other element.

@flofourcade
Copy link
Contributor Author

Yes, at first I wanted to do thing this way But there are a lot of other plugins (sort,massload,, )and so I had to add a lot of new attributes to handle the config of each plugin. So I choosed to use only one "generic" attribute for all plugins., at first.
If you want I'll add searchTopic and searchElementId and we'll see later if we add attribute for other plugins.

flofourcade added a commit to flofourcade/struts2-jquery that referenced this pull request Jul 21, 2016
- added searchTopic, searchElementId and onSearchCompleteTopics
- update showcase
@flofourcade
Copy link
Contributor Author

@jogep
added searchTopic searchElementId, and onSearchCompleteTopics., and updated the showcase.
I refs this PR in my commit. Should I open a new PR or can you merge from this one ?

@jogep
Copy link
Contributor

jogep commented Jul 22, 2016

Sorry, but it looks like a new PR is necessary.

@flofourcade
Copy link
Contributor Author

OK. The search plugin has also "clear_search" method and event. To be complete on the search plugin, I'll add it to tree tag then submit a new PR.

flofourcade added a commit to flofourcade/struts2-jquery that referenced this pull request Jul 22, 2016
- added searchClearTopic and onSearchClearTopics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants