×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Need help with formatting a child row slider - I am close but yet do far - HELP!!!!!

Need help with formatting a child row slider - I am close but yet do far - HELP!!!!!

Need help with formatting a child row slider - I am close but yet do far - HELP!!!!!

(OP)
I just keep getting undefined.

CODE --> Javascript

<script>
function format ( object ) {
    let data=object;
    let x = '';
    let txt='';
    console.log(object);
    //data=object;
    
    try {
  if (x != undefined) {
    // Executes for declared variables that are not undefined nor null
    console.log( 'X is okay ' + x)
  } // (Nothing happens)
} catch (x) {
  console.log('Catch ' + x) // ReferenceError: x is not defined
}
    //Json.parse(data);
     for (x in data) {
              txt += data[x].Tillid + ' Line No:' + data[x].LineNo + ' ' +data[x].Productcode + ' ' + data[x].ProductDescription+' ' + parseFloat(data[x].LineSalePriceIncDisc).toFixed(2) +"\n";
              
                    
                    
     return '<div class="slider">'+ 
     '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">'+
        '<tr>'+
            '<td>Till Name:</td>'+
            '<td>'+ data[x].Tillid + '</td>'+
            '<td>Product Description:</td>'+
            '<td>'+''+'</td>'+
        '</tr>'+
        '<tr>'+
            '<td>Customer Name:</td>'+
            '<td>'+ console.log(data[x].ProductDescription)  +'</td>'+
        '</tr>'+
        '<tr>'+
            '<td>Extra info:</td>'+
            '<td>And any further details here (images etc)...</td>'+
        '</tr>'+
    '</table>';
}
 }
</script>``` 
example of data below:

{Tillid: "MAINTILL", LineNo: "1", Productcode: "15479", ProductDescription: "Cadent 1 Blk Lagre", SingleSalePrice: "380.0000", …}
{Tillid: "MAINTILL", LineNo: "2", Productcode: "11571", ProductDescription: "Helm 58-62 Mission EVO Silver", SingleSalePrice: "19.9900", …}

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close