EasyUI Forum
April 26, 2024, 05:54:21 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: e.preventDefault(); in tree node?  (Read 15083 times)
kavvson
Newbie
*
Posts: 23


View Profile
« on: October 14, 2014, 10:14:52 AM »

 
Code:
onClick: function(node){
alert(node.text);  // alert node text property when clicked

$.get(
$(this).attr('href'),
function(data) {
  $('#te').html(data);
  }
);

}

I got such code, and I wan't to disable in the node the <a> tag - normally it works with  e.preventDefault(); but it seems like it can't be added here.

Its because I have a formatter for the tree

Code:
if (node.text > 0){ return '<a class=clicker href=logs/'+node.text+'/' + node.text + '.log>' + node.text + '</a>';}
« Last Edit: October 14, 2014, 10:47:32 AM by kavvson » Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #1 on: October 14, 2014, 12:37:05 PM »

the onClick is on what, exactly?
Logged
kavvson
Newbie
*
Posts: 23


View Profile
« Reply #2 on: October 15, 2014, 03:28:39 AM »

Onclick the node text that was been created with <a href> it would load the data into my textarea ( its a .log reader )
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #3 on: October 15, 2014, 07:09:04 AM »

of the <a> is inside the element that the onClick on, the the <a>'s own onlick will complete before that handler. 
Logged
kavvson
Newbie
*
Posts: 23


View Profile
« Reply #4 on: October 15, 2014, 09:09:43 AM »

so how could I handle it?
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #5 on: October 15, 2014, 12:37:39 PM »

don't put the href to the file, instead have your onlick handle it. 
Logged
kavvson
Newbie
*
Posts: 23


View Profile
« Reply #6 on: October 15, 2014, 01:01:22 PM »

Looking on the above code. What would it be and now to call in the tag the onclick trigger
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #7 on: October 15, 2014, 01:04:59 PM »

the above code is incomplete.  I can only speculate to what your actual issue is.  I don't know where they values come from, or even where they are going to.  I will say that if you want handle on the onClick, then handle it on that onClick. where you keep the values and get the data from is something that can be done a dozen ways.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!