Loading ...
Sorry, an error occurred while loading the content.

17590Re: [ydn-javascript] data table formatLink problem

Expand Messages
  • Satyam
    Sep 2, 2007
      I think I have a better one.  Change this line:
           this.myDataTable.subscribe("rowClickEvent", this.myDataTable.onEventSelectRow);
      to this:
           this.myDataTable.subscribe("rowClickEvent", function (o) {
              if (o.target.tagName.toLowerCase() != 'a') {
      That means, if the target of the event is  not a link, go on an select the row, if it is, do nothing.  The event will eventually bubble out and with nothing to stop it, the link will be followed through.  The problem, I think, is that the onEventSelectRow does a   YAHOO.util.Event.stopEvent(evt); (actually in line 6257) which prevents the event to follow in its tracks.  
      So, if you actually want the link to be followed, the above solution might be easier.  If you want to do something else with the link, you can listen to linkClickEvent and stop the event propation there.  Nevertheless, stopping the natural propagation of the event would not prevent the loop at _onTbodyClick from carrying on so the rowClickEvent would be triggered as well as all the rest.
      Give it a try and let us know.  Obrigado
      ----- Original Message -----
      From: Satyam
      Sent: Sunday, September 02, 2007 11:11 PM
      Subject: Re: [ydn-javascript] data table formatLink problem

      I just checked the source and this has changed from 2.2.2 to 2.3.0 so whatever I recalled from previous versions does not matter.
      You would have to listen to linkClickEvent, which will fire before rowClickEvent. 
      You can see it in datatable-beta.js, search for the method:
      and you will see that it loops through all the elements from the one clicked outwards, like bubbling,until ir reaches the <table> element itself. 
      What I don't know is how to stop it from bubbling all the way up.  If you find out, let us know.
      ----- Original Message -----
      Sent: Sunday, September 02, 2007 10:31 PM
      Subject: Re: [ydn-javascript] data table formatLink problem


      Thanks for response!

      I am using YUI 2.3.0.

      Look my code:


      this.myDataSource = new YAHOO.util.DataSource(uri);
          this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_TEXT;
          this.myDataSource.responseSchema = {
              recordDelim: "|", // Record delimiter
              fieldDelim: ",", // Field delimiter

          var myConfigs = {
                      paginator: {
                          rowsPerPage: 10,
                          dropdownOptions: [10,20,30,50,100]
                      pageLinks: 3
          this.myDataTable = new YAHOO.widget.DataTable("basic", myColumnDefs,     this.myDataSource, myConfigs,{caption:"DataTable Consulta",           selectionMode:"single"} );
          // Subscribe to events for row selection
              this.myDataTable.subscribe("rowMouseoverEvent", this.myDataTable.onEventHighlightRow);
              this.myDataTable.subscribe("rowMouseoutEvent", this.myDataTable.onEventUnhighlightRow);
              this.myDataTable.subscribe("rowClickEvent", this.myDataTable.onEventSelectRow);



      when not using "row selection" the link in DataTable query result works fine...

      I believe to be a bug in Yui DataTable!

      Thanks again,

      Rodrigo Haas

      Satyam <satyam@...> escreveu:
      I remember that links didn't work in some old version of YUI, 2.1 or before.  They were fixed, or so I recall, I didn't test them myself, in 2.2 or thereabouts.

      Flickr agora em português. Você clica, todo mundo vê. Saiba mais.

      No virus found in this incoming message.
      Checked by AVG Free Edition.
      Version: 7.5.484 / Virus Database: 269.13.2/983 - Release Date: 01/09/2007 16:20

      No virus found in this incoming message.
      Checked by AVG Free Edition.
      Version: 7.5.484 / Virus Database: 269.13.2/983 - Release Date: 01/09/2007 16:20
    • Show all 8 messages in this topic