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

Re: [ydn-javascript] ? on DataTable looping through records

Expand Messages
  • Satyam
    The array is one of Record objects, not of plain objects. You still have to use getData() to read individual fields: r[i].getData( Last Name ); ... From:
    Message 1 of 4 , Dec 20, 2007
      The array is one of Record objects, not of plain objects.  You still have to use getData() to read individual fields:
       
      r[i].getData("Last Name");
       
       
      ----- Original Message -----
      Sent: Friday, December 21, 2007 1:48 AM
      Subject: Re: [ydn-javascript] ? on DataTable looping through records

      No success yet -- I updated the first section of the code to include that change, but it still reads the value(s) as undefined.

      The code now looks like this:

      function saveChanges() {
           r = contactsDataTable.getRecordSet ().getRecords();
           // Added functionality(?) to detect missing last name

           var stopProcess = "false";
           for(var i in r){

                 // ** Here is the added line **
                 if ( YAHOO.lang.hasOwnProperty(r, i)) {

                      alert("Last Name = " + r[i]["LastName"]);
                      if(r[i]["Last Name"] == "" || r[i]["LastName"] == undefined){
                          toSelect = "yui-dt0-bdrow" + i;
                          contactsDataTable.select(toSelect);
                          alert("The selected record does not have a last name; please fill in last name.");
                          stopProcess = "true";
                     }
                // ** and its associated closing **
                }
           }


      On Dec 20, 2007 7:09 PM, Devin Singleton < devsin@...> wrote:

      Not sure if this is it, but try adding

      if (YAHOO.lang.hasOwnProperty(r, i)) {

      after



      for(var i in r){


      Devin







      --
         Duncan Stewart


      No virus found in this incoming message.
      Checked by AVG Free Edition.
      Version: 7.5.503 / Virus Database: 269.17.5/1190 - Release Date: 19/12/2007 19:37
    Your message has been successfully submitted and would be delivered to recipients shortly.