Tree Macro - preventDefault doesnt work

As i implemented fixed sidebar with scrollable content here(will add howto soon), Im trying to go further and reload only the contentcolumn div when sidebar navigation link is clicked.

I use this jsx:

require(['jquery', "$!services.webjars.url('org.xwiki.platform:xwiki-platform-tree-webjar', 'require-config.min.js', {'evaluate': true})"], function($) {
   require(['tree'], function($) {
        $('.xtree').on("click", "a",function (e, data) {
        e.preventDefault();
        $("#contentcolumn").load(this.href + " #contentcolumn" );
      });
  });
});

This code works, center column is updated, but for some reason preventDefault doesnt work thus whole page is eventuelly reloaded.

Do you have any clue why is that?

I have already tried stopPropagation, stopImmediatePropagation and return false - but still the same result. It works everywhere but not inside of Tree Macro.

Even when I disable all clicks on the page, all links on the Tree Macro are still working. Weird.

  $(window).on('click', function(evt) {
  evt.preventDefault();
})

nice :+1:

Sorry can’t help you with your questions though, I’m not very good with JS. I hope someone else can help you.

thanks! maybe @mflorea can help?

@DavidBrazda see xwiki-platform/xwiki-platform-core/xwiki-platform-tree/xwiki-platform-tree-webjar/src/main/webjar/tree.js at master · xwiki/xwiki-platform · GitHub . Maybe try to add the jstree-no-link CSS class to the tree container?