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

Re: [ydn-javascript] data table formatLink problem

Expand Messages
  • Satyam
    There is a typo in the code below, the line within the conditional should be: this.myDataTable.onEventSelectRow(o); ... From: Satyam To:
    Message 1 of 8 , Sep 3, 2007
    • 0 Attachment
      There is a typo in the code below, the line within the conditional should be:
       
                  this.myDataTable.onEventSelectRow(o);
       
      ----- Original Message -----
      From: Satyam
      Sent: Monday, September 03, 2007 1:06 AM
      Subject: Re: [ydn-javascript] data table formatLink problem

      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') {
                  this.myDataTable.onEventSelectRow);
              }
          });
       
      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
       
      Satyam
       
       
       
      ----- 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:
       
      YAHOO.widget.DataTable.prototype._onTbodyClick
       
      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.
       
      Satyam
       
       
       
       
       
       
      ----- Original Message -----
      Sent: Sunday, September 02, 2007 10:31 PM
      Subject: Re: [ydn-javascript] data table formatLink problem

      Satyam,

      Thanks for response!

      I am using YUI 2.3.0.

      Look my code:

      <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
              fields: ["VIA_TIPO","VIA_TITULO","NOMEVIA","SUBLOTE","NUMERO","BAIRRO","NUM_CEP","DESCRICAO","SITE"]  

          }
         
          var myConfigs = {
                      paginated:true,
                      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);


          }

      </code>

      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.
       
      Satyam
      _._,___

      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


      No virus found in this incoming message.
      Checked by AVG Free Edition.
      Version: 7.5.484 / Virus Database: 269.13.2/985 - Release Date: 02/09/2007 16:32
    • Satyam
      Finally, forget about all those replies, I shouldn t be checking my mail past midnight. This works, I have just tested it:
      Message 2 of 8 , Sep 3, 2007
      • 0 Attachment
        Finally, forget about all those replies, I shouldn't be checking my mail past midnight.  This works, I have just tested it:
         
           this.myDataTable.subscribe("linkClickEvent", function(o) {
            location.href = o.target.href;
           });
         
        Satyam
         
         
        ----- Original Message -----
        From: Satyam
        Sent: Monday, September 03, 2007 9:14 AM
        Subject: Re: [ydn-javascript] data table formatLink problem

        There is a typo in the code below, the line within the conditional should be:
         
                    this.myDataTable.onEventSelectRow(o);
         
        ----- Original Message -----
        From: Satyam
        Sent: Monday, September 03, 2007 1:06 AM
        Subject: Re: [ydn-javascript] data table formatLink problem

        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') {
                    this.myDataTable.onEventSelectRow);
                }
            });
         
        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
         
        Satyam
         
         
         
        ----- 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:
         
        YAHOO.widget.DataTable.prototype._onTbodyClick
         
        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.
         
        Satyam
         
         
         
         
         
         
        ----- Original Message -----
        Sent: Sunday, September 02, 2007 10:31 PM
        Subject: Re: [ydn-javascript] data table formatLink problem

        Satyam,

        Thanks for response!

        I am using YUI 2.3.0.

        Look my code:

        <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
                fields: ["VIA_TIPO","VIA_TITULO","NOMEVIA","SUBLOTE","NUMERO","BAIRRO","NUM_CEP","DESCRICAO","SITE"]  

            }
           
            var myConfigs = {
                        paginated:true,
                        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);


            }

        </code>

        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.
         
        Satyam
        _._,___

        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


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


        No virus found in this incoming message.
        Checked by AVG Free Edition.
        Version: 7.5.484 / Virus Database: 269.13.2/985 - Release Date: 02/09/2007 16:32
      • Satyam
        I just submitted a feature request based on your need, at: https://sourceforge.net/tracker/?func=detail&atid=836479&aid=1786956&group_id=165715 A more generic
        Message 3 of 8 , Sep 3, 2007
        • 0 Attachment
          I just submitted a feature request based on your need, at:
           
           
          A more generic function would read the target from the link object and act accordingly so there is no need to have different functions depending on whether you want to navigate within the same page or go to a new page.   Thus, the target information would be in the link itself, as expected.  The formatLink method provided, though, does not create links with a target attribute, but the links might come already formatted as links from elsewhere and some columns might have targets, others not and the link click event cannot know which column the event came from and it should not care either.
           
          pracer
           
          Satyam
           
          ----- Original Message -----
          Sent: Monday, September 03, 2007 9:45 PM
          Subject: Res: [ydn-javascript] data table formatLink problem

          Satyam,


          Now "DataTable formatLink with Row Selection" works fine!

          Thanks a lot for response!

          I made a change in your last code for open link in new window (tested in IE7,Firefox 2.0.0.6,Opera 9.23) :

          <code>

           this.myDataTable.subscribe(" linkClickEvent" , function(o) {
              location.href = o.target.href;
             });

          </code>

          For this:

          <code>

          this.myDataTable.subscribe("linkClickEvent" , function(o) {
              window.open(o.target.href, '_blank');
           });

          </code>


          Muchas Gracias Ermano!


          Rodrigo Haas - Brasil



          ----- Mensagem original ----
          De: Satyam <satyam@...>
          Para: ydn-javascript@yahoogroups.com
          Enviadas: Segunda-feira, 3 de Setembro de 2007 5:35:43
          Assunto: Re: [ydn-javascript] data table formatLink problem

          Finally, forget about all those replies, I shouldn't be checking my mail past midnight.  This works, I have just tested it:
           
             this.myDataTable.subscribe(" linkClickEvent" , function(o) {
              location.href = o.target.href;
             });
           
          Satyam
           
           
          ----- Original Message -----
          From: Satyam
          Sent: Monday, September 03, 2007 9:14 AM
          Subject: Re: [ydn-javascript] data table formatLink problem

          There is a typo in the code below, the line within the conditional should be:
           
                      this.myDataTable. onEventSelectRow (o);
           
          ----- Original Message -----
          From: Satyam
          Sent: Monday, September 03, 2007 1:06 AM
          Subject: Re: [ydn-javascript] data table formatLink problem

          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') {
                      this.myDataTable. onEventSelectRow );
                  }
              });
           
          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
           
          Satyam
           
           
           
          ----- 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:
           
          YAHOO.widget. DataTable. prototype. _onTbodyClick
           
          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.
           
          Satyam
           
           
           
           
           
           
          ----- Original Message -----
          Sent: Sunday, September 02, 2007 10:31 PM
          Subject: Re: [ydn-javascript] data table formatLink problem

          Satyam,

          Thanks for response!

          I am using YUI 2.3.0.

          Look my code:

          <code>

          this.myDataSource = new YAHOO.util.DataSour ce(uri);
             
           
              this.myDataSource. responseType = YAHOO.util.DataSour ce.TYPE_TEXT;
             
              this.myDataSource. responseSchema = {
                  recordDelim: "|", // Record delimiter
                  fieldDelim: ",", // Field delimiter
                  fields: ["VIA_TIPO", "VIA_TITULO" ,"NOMEVIA" ,"SUBLOTE" ,"NUMERO" ,"BAIRRO" ,"NUM_CEP" ,"DESCRICAO" ,"SITE"]  

              }
             
              var myConfigs = {
                          paginated:true,
                          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( "rowMouseoverEve nt", this.myDataTable. onEventHighlight Row);
                  this.myDataTable. subscribe( "rowMouseoutEven t", this.myDataTable. onEventUnhighlig htRow);
                  this.myDataTable. subscribe( "rowClickEvent" , this.myDataTable. onEventSelectRow );


              }

          </code>

          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@satyam. com.ar> 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.
           
          Satyam
          _._,___

          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

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

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


          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/985 - Release Date: 02/09/2007 16:32
        Your message has been successfully submitted and would be delivered to recipients shortly.