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

Custom node html causes issues when jstree.dnd tries to find the anchor element #13

Closed
stevehodgkiss opened this issue May 24, 2011 · 2 comments

Comments

@stevehodgkiss
Copy link

Hi

First of all, thanks for this awesome plugin!

My tree outputs extra elements so that it can have columns on the right with check boxes for stuff. It looks like this:

<li class="jstree-leaf">
  <div class="page">
    <div class="col1" style="width: 635px;">
      <a href="#" class="title">Testing</a>
    </div>
    <div class="col2">
      <div class="actions"></div>
      <div class="published"><input type="checkbox" value="1" name="published" id="published"></div>
    </div>
  </div>
</li>

The problem occurs when using the dnd plugin (with html_data and themes) and you start to drag an element. It can't find the first child anchor because it's inside a div and it fails - https://github.com/vakata/jstree/blob/v.pre1.0/jquery.jstree.js#L801 I'm using the downloaded pre1 code from the site.

I had to change it to obj = obj.find("a:first"); for it to work with my app. This selector (.children("a:eq(0)")) is used 8 times in the app, do you think it could be made configurable? Or is there a better solution I'm not seeing?

Thanks

@vakata
Copy link
Owner

vakata commented May 25, 2011

I am currently working on implementing jstreegrid in the core (it is a user plugin) - that will allow for tree grids. pre 1.0 versions have very strict requirements regarding the html contents of each node, this is why your code is not working. I will do my best for the upcoming 1.0 version (there already are major changes in the way HTML is treated).

@stevehodgkiss
Copy link
Author

Great, looking forward to v1!

Thanks

@vakata vakata closed this as completed Jul 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants