Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

CompleteNumpty

Technical User
Nov 21, 2020
1
GB
I just keep getting undefined.

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", …}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top