Normal link-behavior broken

Hey,

I am working right now with reactivetable and wanted to insert a link (the name of the patient and with the unique id) like always with routing (iron:router). Everything works fine except one thing. Links are only reachable with right -> click open in new tab.

The code goes like this:

tableSettings: function() {
    return {
      rowsPerPage: 10,
      showFilter: true,
      showNavigation: 'auto',
      fields: [{
        key: 'name',
        label: 'Name',
        fn: function(name, object) {
          var html = '<a href="' + /medicationPlan/ + object._id + '">' + name + '</a>';
          return new Spacebars.SafeString(html);
        }
      },  ....

I tried this solution vs. hardcoding links vs. this one its always the same.

I dont know how to solve it… If some info is missing, just tell me. I will give everything I can provide to solve this…
Maybe there is a other listener or something covering the anchor-tag I dunno…

Thanks in advance :slightly_smiling:

Haven’t worked with that package, but after working with datatables, I think you are probably on the right path about another listener blocking your click. Do you get anything in the console log with a normal click? Do you have an example to share?

No sadly there is no output with console.log and I cant find the listener. What do you mean with example? A screen to show the app?

Basically I have copied this example; there everything works fine - see… damn I cant put more than 2 links because I am a new user…

After that I tried this one but I don’t really get it because Routes.route is no iron:router Syntax maybe its a typo. Also the path thing confuses me - is there some source to explain the topic further?

I have the feeling that I am missing something crucial… Are there any good debugging tools for chrome, to track the listener or something.

see here

So I’m not sure what your code looks like, but if you look at the example that @futuress linked to, you can examine some templates to see what events are assigned.

Running Template.reactiveTable.__eventMaps[0] in your console will show you the events attached to the reactiveTable template. I’d suggest doing something similar in your app to see the click events that may be attached to the templates you are using?

Hey,

this is what I get:

This doesn’t look for me like any other event is attached to the anchor-tag.

Is it possible to add a class to the href and show the link template? like imitating the normal link behavior but somehow this sounds like a cheesy solution, if its possible at all.

Yeah, that is tough without seeing everything together. I guess it depends on how much this is holding you up, as you could do something hacky like add a class to the a tag with an event handler and pass the handler the href. But that is really not ideal.

Do you have the app running online anywhere that you could share?

Soooo… such a stupid bug…

Blindly copying code and inserting it without checking everything is often not advised!

The error was in the e.preventDefault() in my click event inside the reactivetable template.
Nevertheless I learned something about templates and blaze all along :smile:

Template.patients.events({
  "click .reactive-table tbody tr": function(event) {
   // event.preventDefault(); <--- DONT DO IT :wink: 
    var selectedPatient = this;
    if (event.target.className == "deletebtn") {
      var confirm = window.confirm("Namen wirklich löschen?");
      if (confirm === true) {
        Meteor.call('removePatient', selectedPatient._id);
      }
    }
  }
})

Haha, well glad you figured it out!