Hi I am trying to implement a data table in Visualforce page. I have included the jquery.js, DataTable.Min.Js, Datatable.js in the page in this order. I have initialize the data table like below
$(document).ready( function () {
var oTable1 = $('#LeadTable').dataTable( {
"sPaginationType": "full_numbers",
"aoColumnDefs": [ { "bVisible": false, "aTargets": [ ] }],
"bLengthChange": false,
"bAutoWidth": false,
"iDisplayLength" : 20,
"aaSorting": [[ 4, "desc" ]],
"oColumnFilterWidgets": { "aiExclude": [ 0, 3, 4 ] }
});
});
I am getting the error "Object doesn't support property or method 'dataTable'". I check what is the issue?
Thanks.
VF page
<apex:page controller="HomeBasedClass" id="thePage" >
<apex:stylesheet value="{!$Resource.RoleHierarchyPopupStyle}"/>
<style type="text/css">
body{
background-color: #f5f5f5;
}
#Initialloading{
width: 100%;
height: 500px;
top: 200px;
/*left: 200px;*/
/*position: fixed;*/
display: block;
z-index: 99
}
#loading-image{
position: absolute;
top: 40%;
left: 45%;
z-index: 100
}
</style>
<script type="text/javascript">
var i = setInterval(function () {
clearInterval(i);
// The desired code is only this:
document.getElementById("Initialloading").style.display = "none";
document.getElementById("thePage:formId").style.display = "";
}, 5000);
</script>
<script type="text/javascript">
function showPopUp(divId)
{
document.getElementById(divId).style.display = '';
}
function ClosePopup(divId){
document.getElementById(divId).style.display = 'none';
}
</script>
<style>
#LeadTable { border-collapse: collapse; }
h3 { color: #333333;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 20px;
}
#panel table { border-collapse: collapse; }
</style>
<style>
.button { background: url('{!$Resource.LoadingButton}') no-repeat left top; width:335px; height:65px;}
.circle {
width:22px;
height:22px;
float:left;
margin-bottom:18px;
margin-top:18px;
margin-left: 55px;
}
.txt {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:13px;
color:#000000;
line-height:20px;
margin-left:15px;
margin-bottom:18px;
margin-top:18px;
width: 200px;
font-weight: bold;
float: left;
}
#TaskTable_paginate {
height:35px;
}
</style>
<div id="Initialloading" align="center">
<img src="{!$Resource.Loading}" />
<br/><br/>
<font color="Red">Please Wait...</font>
</div>
<apex:form id="formId" style="display:none;">
<!--<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>-->
<!--<apex:includeScript value="{!$Resource.jQueryLib19Compress}"/>
<script src="{!URLFOR($Resource.DataTables, 'media/js/jquery.dataTables.min.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/jquery.dataTables.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/ColVis.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/ZeroClipboard.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/TableTools.js')}"></script>
<script src="{!URLFOR($Resource.DataTables, 'media/js/ColumnFilterWidgets.js')}"></script>-->
<apex:includeScript value="{!$Resource.DtJQueryJs}"/>
<apex:includeScript value="{!$Resource.DtDataTableMinJs}"/>
<apex:includeScript value="{!$Resource.DtDataTableJs}"/>
<apex:stylesheet value="{!URLFOR($Resource.DataTables, 'media/css/DataTablesAdvancedExample.css')}"/>
<script type="text/javascript">
$(document).ready( function () {
var oTable1 = $('#LeadTable').dataTable( {
"sPaginationType": "full_numbers",
"aoColumnDefs": [ { "bVisible": false, "aTargets": [ ] }],
"bLengthChange": false,
"bAutoWidth": false,
"iDisplayLength" : 20,
"aaSorting": [[ 4, "desc" ]],
"oColumnFilterWidgets": { "aiExclude": [ 0, 3, 4 ] }
});
var oTable2 = $('#JobprofileTable').dataTable( {
"sPaginationType": "full_numbers",
"iDisplayLength" : 5,
"bLengthChange": false,
"aoColumnDefs": [ { "bVisible": false, "aTargets": [ ] }],
"aaSorting": [[ 5, "desc" ]],
"oColumnFilterWidgets": { "aiExclude": [ 0, 3, 4 ]}
});
});
function startSplash() {
document.getElementById('splashDiv').style.display='';
}
function endSplash() {
document.getElementById('splashDiv').style.display='none';
}
</script>
<div class="button" id="splashDiv" style="display: none; position: fixed; left: 500px; top: 250px; border: 0px; z-index: 9999;">
<div class="circle"><apex:image value="{!$Resource.LoadingImage}"></apex:image></div>
<div class="txt">Please Wait. Loading...</div>
</div>
<apex:actionStatus id="splashStatus" onstart="startSplash();" onstop="endSplash();" />
<apex:actionFunction name="ajaxSetClientLoaded" action="{!setClientLoaded}" immediate="true" rerender="formId"/>
<apex:sectionHeader subtitle="Home Base - Sales Rep Dashboard"/>
Leads |<apex:outputLabel > </apex:outputLabel><apex:outputLabel >Job Profiles</apex:outputLabel><apex:outputLabel > |</apex:outputLabel> Opportunities | Activities | Orders & Deliveries<br/><br/><br/>
<label style="cursor:pointer; text-decoration:underline" onclick="showPopUp('descreteAddDiv');">{!$UserRole.Name}</label><br/><br/>
<div id="descreteAddDiv" style="display:none;">
<apex:outputPanel styleClass="DescAddresspopupBackground" layout="block" />
<apex:outputPanel id="fulfillingBranchPanel" style="-moz-border-radius: 15px;-webkit-border-radius: 15px;border-radius: 10px;" styleClass="custDescAddressPopup" layout="block" >
<div style="width:25px; float:right;padding:5px 5px; cursor:pointer;" onclick="ClosePopup('descreteAddDiv');">[X]</div>
<apex:iframe src="/apex/testpage" width="100%" height="350px" scrolling="true"/>
</apex:outputPanel>
</div>
<!-- ----------------------------------------------------Lead section Start------------------------------------------ -->
<apex:pageBlock id="leadSection" >
<table width="100%" border="1" cellpadding="5" cellspacing="8">
<tr>
<td align="left" colspan="2"><h3>Leads</h3></td>
</tr>
<tr>
<td width="25%" valign="top" height="265px;">
<apex:outputPanel id="componentPnl">
<c:LeadGraphComponent userId="{!SelectedUserId}" id="LeadComponent"/>
</apex:outputPanel>
</td>
<td width="75%" valign="top">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="LeadTable" >
<thead>
<tr>
<th style="font-weight: bold; text-align: center; font-family: Arial; font-size: 8pt;">Company</th>
<th>Name</th>
<th>Phone</th>
<th>Servicing Branch ID</th>
<th>Created Date</th>
<th>Last Activity Date</th>
<th>Next Activity Date</th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!LstLeadGrid}" var="c">
<tr>
<td>{!c.Company}</td>
<td>{!c.Name}</td>
<td>{!c.Phone}</td>
<td>{!c.Servicing_Branch_Id__c}</td>
<td>
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!c.Created_Date_Time__c}"/>
</apex:outputText>
</td>
<td>
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!c.Last_Activity_Datetime__c }" />
</apex:outputText>
</td>
<td>
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!c.Next_Activity_Date__c}" />
</apex:outputText>
</td>
</tr>
</apex:repeat>
</tbody>
</table>
</td>
</tr>
</table>
</apex:pageBlock>
<!-- ----------------------------------------------------Lead section End------------------------------------------ -->
<!-- ----------------------------------------------------Job Profile section Start------------------------------------>
<!-- ------rendered="{!IF(($UserRole.Name == 'Branch Manager - US') || ($UserRole.Name == 'Customer Sales Specialist - NSC - US') || ($UserRole.Name == 'Regional Manager - US') || ($UserRole.Name == 'Sales Rep - US') || ($UserRole.Name == 'Territory Sales Mgr - US'),true,false)}"---->
<apex:pageBlock id="jobProfileSection" >
<table width="100%" border="1" cellpadding="5" cellspacing="8">
<tr>
<td align="left" colspan="2"><h3>Job Profiles</h3></td>
</tr>
<tr>
<td width="25%" valign="top" height="265px;">
<apex:outputPanel id="componentPnl">
<c:JobProfileComponent userId="{!SelectedUserId}" id="JpComponent"/>
</apex:outputPanel>
</td>
<td rowspan="2" width="75%" valign="top">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="JobprofileTable" >
<thead>
<tr>
<th>Job profile Name</th>
<th>Job Profile ID</th>
<th>BranchID</th>
<th>Valuation</th>
<th>GC Name</th>
<th>JS City</th>
<th>JS State</th>
<th>Job Name</th>
<th>JS Zip</th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!LstJobProfileGrid}" var="c">
<tr>
<td align="left" style="font-colour: black;">{!c.Name}</td>
<td align="center">{!c.Job_Profile_ID__c}</td>
<td align="center">{!c.Branch_ID__c}</td>
<td align="center">{!c.Valuation__c}</td>
<td align="center">{!c.GC_Awarded_Dodge__c}</td>
<td align="center">{!c.Job_Site_City__c}</td>
<td align="center">{!c.Job_Site_State__c}</td>
<td align="center">{!c.Name}</td>
<td align="center">{!c.Job_Site_Zip__c}</td>
</tr>
</apex:repeat>
</tbody>
</table>
</td>
</tr>
</table>
</apex:pageBlock>
<!-- ----------------------------------------------------Job Profile End------------------------------------------ -->
<!-- ----------------------------------------------------Opportunity section Start------------------------------------------ -->
<apex:pageBlock id="OpportunitySection">
<c:OpportunityComponent userId="{!SelectedUserId}" id="OppComponent"/>
</apex:pageBlock>
<!-- ----------------------------------------------------Opportunity section End------------------------------------------ -->
<!-- ----------------------------------------------------Activity section Starts------------------------------------------ -->
<apex:pageBlock id="TaskSection">
<script type="text/javascript" charset="UTF-8">
$(document).ready( function () {
var oTable4 = $('#TaskTable').dataTable( {
"sPaginationType": "full_numbers",
"aoColumnDefs": [ { "bVisible": false, "aTargets": [ ] }],
"bLengthChange": false,
"iDisplayLength" : 20,
"oColumnFilterWidgets": { "aiExclude": [ 0, 3, 4 ] }
});
});
</script>
<table width="100%" border="0">
<tr>
<td align="left">
<h3>My Activities</h3> <a target="_blank" href="https://cs3.salesforce.com/setup/ui/recordtypeselect.jsp?ent=Opportunity&retURL=%2F006%2Fo&save_new_url=%2F006%2Fe%3FretURL%3D%252F006%252Fo" style="Text-decoration:none;Cursor:pointer"><img src="https://cs3.salesforce.com/resource/1359464023000/ZoomImage" Title="Create New Opportunity"/> Create New Opportunity</a>
</td>
<td align="right">
<apex:selectList value="{!SelectedTaskName}" size="1" style="width:250px;">
<apex:selectOptions value="{!lstTaskOptions}"/>
<apex:actionSupport event="onchange" action="{!ChangeSelectedTaskName}" rerender="TaskSection" status="splashStatus"/>
</apex:selectList>
</td>
</tr>
</table>
<div id="panel" >
<table cellpadding="0" cellspacing="0" border="0" class="display" id="TaskTable" style="margin-top:20px;">
<thead>
<tr>
<th>Subject</th>
<th>Due Date</th>
<th>MMI Call Type</th>
<th>Account Name</th>
<th>Name</th>
<th>Related To</th>
<th>Phone</th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!LstTaskGrid}" var="c">
<tr>
<td>{!c.Subject}</td>
<td style= "{!IF(AND(NOT(ISBLANK(c.ActivityDate)),c.ActivityDate- Today() < 0), 'color:red;', 'color:black;')}">
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!c.ActivityDate}" />
</apex:outputText>
</td>
<td>{!c.Call_Type__c}</td>
<td>{!c.Account.Name}</td>
<td>{!c.Who.Name}</td>
<td>{!c.What.Name}</td>
<td>{!c.Who.Phone}</td>
</tr>
</apex:repeat>
</tbody>
</table>
</div>
</apex:pageBlock>
<!-- ----------------------------------------------------Activity section End------------------------------------------ -->
<!-- ----------------------------------------------------Order and Delivery section Starts------------------------------------------ -->
<div style="width:100%; overflow:auto;border: 1px solid #F00;" >
<apex:pageBlock id="OrderSection">
<script type="text/javascript" charset="UTF-8">
$(document).ready( function () {
var oTable5 = $('#OrderTable').dataTable( {
"sPaginationType": "full_numbers",
"aoColumnDefs": [ { "bVisible": false, "aTargets": [ ] }],
"bLengthChange": false,
"bAutoWidth": false,
"iDisplayLength" : 15,
"oColumnFilterWidgets": { "aiExclude": [ 0, 3, 4 ] }
});
});
</script>
<table width="100%" border="0">
<tr>
<td align="left">
<h3>Orders & Deliveries</h3>
</td>
<td align="right">
<apex:selectList value="{!SelectedlstOrdDelivOptionsName}" size="1" style="width:250px;">
<apex:selectOptions value="{!lstOrdDelivOptions}"/>
<apex:actionSupport event="onchange" action="{!ChangeOrderDelivery}" rerender="OrderSection" status="splashStatus"/>
</apex:selectList><br/><br/>
<apex:selectList value="{!SelectedOrdDelivTimeName}" size="1" style="width:250px;">
<apex:selectOptions value="{!lstOrdDelivTimeOptions}"/>
<apex:actionSupport event="onchange" action="{!ChangeOrderDelivery}" rerender="OrderSection" status="splashStatus"/>
</apex:selectList>
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="OrderTable" style="margin-top:20px;">
<thead>
<tr>
<th>Account #</th>
<th>Account Name</th>
<th>Order Type</th>
<th>Transaction Code</th>
<th>Servicing Branch ID</th>
<th>Item Code</th>
<th>Total Amt</th>
<th>Delivery Date</th>
<th>Activation Date</th>
<th>Fuel Surcharge Delivery</th>
<th>Fuel Surcharage PickUp</th>
<th>PPE</th>
<th>LLW</th>
<th>Delivery Contact Name</th>
<th>Delivery Contact #</th>
<th>Order #</th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!LstOrdersAndDelieveriesGrid}" var="c">
<tr>
<td>{!c.Account_Number__c}</td>
<td>{!c.Name}</td>
<td>{!c.Transaction_Code__c}</td>
<td>{!c.Transaction_Code__c }</td>
<td>{!c.Transaction_Code__c}</td>
<td>{!c.Item_Code__c}</td>
<td>{!SUBSTITUTE(TEXT(ROUND(c.Total__c, 0)), ".", "," )}</td>
<td>
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!c.Delivery_Date__c}"/>
</apex:outputText>
</td>
<td>
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!c.Activation_Date__c}"/>
</apex:outputText>
</td>
<td>
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!c.Fuel_Surcharge_Delivery__c}"/>
</apex:outputText>
</td>
<td>
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!c.Fuel_Surcharage_PickUp__c}"/>
</apex:outputText>
</td>
<td>{!c.PPE__c}</td>
<td>{!c.LLW__c}</td>
<td>{!c.Delivery_Contact_Name__c}</td>
<td>{!c.Delivery_Contact_Number__c}</td>
<td>{!c.Order_Number__c}</td>
</tr>
</apex:repeat>
</tbody>
</table>
</apex:pageBlock>
</div>
<!-- ----------------------------------------------------Order and Delivery section End------------------------------------------ -->
</apex:form>
<style>
body{
background-color: #f5f5f5;
}
/*#OrderTable_wrapper {width:100%; overflow:auto;}*/
</style>
</apex:page>
seems that you should to use the following fix:
var j$ = jQuery.noConflict();
The problem is that force.com also includes a lot of javascript libraries that also may use this $ symbol as a shortcut and this can cause all sorts of problems.
Now where ever you would normally use $, use j$.
Related
i'm working with DomPdf in Laravel. But it not showing all the data.
here's the image (I can't embeded the image because don't have enough reputation) :
IMG1
and this my pdf blade :
body{
background-color: white;
}
.h2pdf{
text-align: center;
}
.h5pdf{
margin-top: -15px;
text-align: center;
}
.devider{
width:100%;
height:10px;
background-color:yellow;
margin-bottom:20px;
margin-top:-10px;
}
.tr-head{
text-align: left;
text-decoration: underline;
text: bold;
font-size: 10px;
height: 1px;
}
.title{
background: #dddddd;
}
.tblpdf{
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
border: 1px solid black;
}
td{
border-left: 1px solid black;
}
.row-fill{
border-bottom: 1px solid black;
}
.page-break {
page-break-after: auto;
}
<body>
<h2 class="h2pdf">Technical Service Report</h2>
<h5 class="h5pdf">Address</h5>
<div class="devider"></div>
<h5 class="h5pdf">TSR No. : {{$head->no_tsr}}</h5>
<table class="tblpdf">
<tr class="title">
<td colspan="3">Customer & Mechanic Detail</td>
</tr>
<tr class="tr-head">
<td>Report By</td>
<td>Mechanic Arrival Date & Time</td>
<td>Technician</td>
</tr>
<tr class="row-fill">
<td>{{$head->report_creator}}</td>
<td>{{date('d-M-Y H:i',strtotime($head->mechanic_arrival_date))}}</td>
<td>{{$head->mechanic_name}}</td>
</tr>
<tr class="tr-head">
<td>Customer</td>
<td>PIC</td>
<td>Site/Province</td>
</tr>
<tr class="row-fill">
<td>{{$head->customer_name}}</td>
<td>{{$head->customer_pic}}</td>
<td>{{$head->customer_site}}</td>
</tr>
<tr class="title">
<td colspan="3">Unit & Failure Detail</td>
</tr>
<tr class="tr-head">
<td>Brand</td>
<td>Model</td>
<td>Category</td>
</tr>
<tr class="row-fill">
<td>{{$head->unit_brand}}</td>
<td>{{$head->unit_model}}</td>
<td>{{$head->unit_category}}</td>
</tr>
<tr class="tr-head">
<td>Serial Number</td>
<td>Hourmeter</td>
<td>Kilometer</td>
</tr>
<tr class="row-fill">
<td>{{$head->unit_sn}}</td>
<td>{{$head->unit_hm}}</td>
<td>{{$head->unit_km}}</td>
</tr>
<tr class="tr-head">
<td>Chasis SN</td>
<td>Engine SN</td>
<td>Machine Application</td>
</tr>
<tr class="row-fill">
<td>{{$head->unit_chasis_sn}}</td>
<td>{{$head->unit_engine_sn}}</td>
<td>{{$head->unit_application}}</td>
</tr>
<tr class="tr-head">
<td>Commisioning Date</td>
<td></td>
<td></td>
</tr>
<tr class="row-fill">
<td>
#if($head->unit_commissioning_date!=NULL)
{{date('d-m-Y',strtotime($head->unit_commissioning_date))}}
#elseif($head->unit_commissioning_date == NULL)
UNKNOWN
#endif
</td>
<td></td>
<td></td>
</tr>
<tr class="tr-head">
<td>Faulty Type</td>
<td>Date & Time of Servicing</td>
<td>Date & Time Completion</td>
</tr>
<tr class="row-fill">
<td>{{$head->faulty_type}}</td>
<td>{{date('d-M-Y H:i',strtotime($head->job_beginning_date))}}</td>
<td>
#if(date('Y-m-d',strtotime($head->job_complete_date))!= '1970-01-01')
{{date('d-m-Y H:i',strtotime($head->job_complete_date))}}
#elseif(date('Y-m-d',strtotime($head->job_complete_date)) == '1970-01-01')
UNFINISHED JOB
#endif
</td>
</tr>
<tr class="tr-head">
<td>Faulty Group</td>
<td>Job Type</td>
<td>Job Status</td>
</tr>
<tr class="row-fill">
<td>{{$head->faulty_group}}</td>
<td>{{$head->job_type}}</td>
<td>{{$head->job_status}}</td>
</tr>
<tr class="tr-head">
<td colspan="3" style="border-top:1px solid black;">Condition</td>
</tr>
<tr class="row-fill">
<td colspan="3">{{$head->unit_condition}}</td>
</tr>
<tr class="title" style="margin-top:5px;">
<td colspan="3">Failure (Complaints)</td>
</tr>
<tr>
<td colspan="3">{!!$head->job_complaint!!}</td>
</tr>
<tr class="title">
<td colspan="3">Failure (Analysis)</td>
</tr>
<tr>
<td colspan="3">{!!$head->job_analysis!!}</td>
</tr>
<tr class="title">
<td colspan="3">Failure (Correction)</td>
</tr>
<tr>
<td colspan="3">{!!$head->job_correction!!}</td>
</tr>
<tr class="title">
<td colspan="3">Failure (Parts)</td>
</tr>
<tr>
<td colspan="3">{!!$head->job_failure_parts!!}</td>
</tr>
</table>
<div class="page-break"></div>
<a>Photo(s)</a>
<table style="text-align:center;border: solid 1px;border-collapse: collapse;">
<tr class="row-fill">
<td colspan="2">
<img src="{{public_path().'/images/TSR/'.$head->url_photo_unit}}" width="350px" height="300px" alt="Unit"><br>Unit
</td>
</tr>
<tr>
<td>
<img src="{{public_path().'/images/TSR/'.$head->url_photo_sn}}" width="350px" height="300px" alt="SN"><br>Serial Number
</td>
<td>
<img src="{{public_path().'/images/TSR/'.$head->url_photo_hm}}" width="350px" height="300px" alt="Hm"><br>Hourmeter
</td>
</tr>
</table>
<div class="page-break"></div>
<table style="border: solid 0.5px;width:100%;text-align: center" >
<tr><td></td></tr>
<?php
$rcount = 0;
foreach($detail as $record){
if ($rcount % 2 == 0){
echo '<tr>';
}
?>
<td>
<img src="{{public_path().'/images/TSR/'.$record->url_photo}}" width="350px" height="300px" alt="image">
<label for="description">{{$record->description}}</label>
</td>
<?php if ($rcount % 2 == 2){
echo '</tr>';
}
$rcount++;
}
//here is a check condition in case you don't have more times multiple of 3 rows
if ($rcount % 2 != 0){
echo '</tr>';
}
?>
</table>
</body>
I already tried the page-break css with :
page-break-before : always
page-break-before : auto
page-break-after : always
page-break-after : auto
But nothing changed. I don't know what the problem is. Please help me, thanks in advance.
I found a way to solve this issue. The data shown completely when we use div instead of table. We just need to add some css on the div so the data will show like we're using table.
Hopefully other people can solve the problem with this method.
I am still learning Vue Js and trying to implement using Laravel APIs.
In the Product Controller when I am passing return response()->json($product); and displaying in Vue Js it works.
But when I have do it for two - return response()->json([$product, $product_materials]);
I am unable to display
<template>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<table class="table table-bordered table-striped">
<tbody>
<tr style="height: 23px">
<td style="width: 75px; height: 23px" colspan="5">
Product Details
</td>
</tr>
<tr style="height: 23px">
<td style="width: 15.5px; height: 23px">ID</td>
<td style="width: 14.5px; height: 23px">{{ product.id }}</td>
<td style="width: 45px; height: 23px" colspan="3"> </td>
</tr>
<tr style="height: 43px">
<td style="width: 15.5px; height: 43px">Name</td>
<td style="width: 14.5px; height: 43px">{{ product.name }}</td>
<td style="width: 15px; height: 43px">Quantity</td>
<td style="width: 30px; height: 43px" colspan="2">
{{ product.quantity }}
</td>
</tr>
<tr style="height: 23px">
<td style="width: 15.5px; height: 23px">Description</td>
<td style="width: 59.5px; height: 23px" colspan="4">
{{ product.description }}
</td>
</tr>
<tr style="height: 23px">
<td style="width: 75px; height: 23px" colspan="5">
Product Material
</td>
</tr>
<tr style="height: 23px">
<td style="width: 15.5px; height: 23px">ID</td>
<td style="width: 14.5px; height: 23px">Description</td>
<td style="width: 15px; height: 23px">Quantity</td>
<td style="width: 15px; height: 23px">Rate</td>
<td style="width: 15px; height: 23px">Amount</td>
</tr>
<tr
style="height: 23.5px"
v-for="product_material in product_materials"
:key="product_material.id"
>
<td style="width: 15.5px; height: 23.5px">
{{ product_material.id }}
</td>
<td style="width: 14.5px; height: 23.5px">
{{ product_material.description }}
</td>
<td style="width: 15px; height: 23.5px">
{{ product_material.quantity }}
</td>
<td style="width: 15px; height: 23.5px">
{{ product_material.rate }}
</td>
<td style="width: 15px; height: 23.5px">
{{ product_material.amount }}
</td>
</tr>
<tr style="height: 23px">
<td style="width: 30px; height: 23px" colspan="2">
Total Material Items
</td>
<td style="width: 15px; height: 23px">
{{ product.material_items }}
</td>
<td style="width: 15px; height: 23px">Material Cost</td>
<td style="width: 15px; height: 23px">
{{ product.material_cost }}
</td>
</tr>
<tr style="height: 23px">
<td style="width: 30px; height: 23px" colspan="2">Waste %</td>
<td style="width: 15px; height: 23px">
{{ product.waste_percentage }}
</td>
<td style="width: 15px; height: 23px">Waste Amount</td>
<td style="width: 15px; height: 23px">
{{ product.waste_amount }}
</td>
</tr>
<tr style="height: 23px">
<td style="width: 30px; height: 23px" colspan="2">Labour cost %</td>
<td style="width: 15px; height: 23px">
{{ product.labour_percentage }}
</td>
<td style="width: 15px; height: 23px">Labour Cost</td>
<td style="width: 15px; height: 23px">
{{ product.labour_amount }}
</td>
</tr>
<tr style="height: 23px">
<td style="width: 30px; height: 23px" colspan="2"> </td>
<td style="width: 30px; height: 23px" colspan="2">
Equipment Cost
</td>
<td style="width: 15px; height: 23px">
{{ product.equipment_cost }}
</td>
</tr>
<tr style="height: 23px">
<td style="width: 30px; height: 23px" colspan="2">Other Cost %</td>
<td style="width: 15px; height: 23px">
{{ product.other_percentage }}
</td>
<td style="width: 15px; height: 23px">Other Cost</td>
<td style="width: 15px; height: 23px">
{{ product.other_amount }}
</td>
</tr>
<tr style="height: 23px">
<td style="width: 30px; height: 23px" colspan="2">Margin %</td>
<td style="width: 15px; height: 23px">
{{ product.margin_percentage }}
</td>
<td style="width: 15px; height: 23px">Margin Amount</td>
<td style="width: 15px; height: 23px">
{{ product.margin_amount }}
</td>
</tr>
<tr style="height: 23px">
<td style="width: 30px; height: 23px" colspan="3"> </td>
<td style="width: 15px; height: 23px">Sub Total</td>
<td style="width: 15px; height: 23px">{{ product.sub_total }}</td>
</tr>
<tr style="height: 23px">
<td style="width: 30px; height: 23px" colspan="3"> </td>
<td style="width: 15px; height: 23px">Total</td>
<td style="width: 15px; height: 23px">{{ product.amount }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log("Component mounted.");
},
data() {
return { product: {}, product_materials: [] };
},
created() {
this.axios
.get(`/api/products/calculate/${this.$route.params.id}`)
.then((res) => {
this.product = res.data;
});
},
};
</script>
I just want to know how to fix this and handle this two when passing through json.
Thank you in advance.
I will suppose this is your structure
$product =
[
'id' => 1,
'name' => 'product1',
];
$product_materials = [
[
'id' => 1,
'name' => 'materials1',
],
[
'id' => 2,
'name' => 'materials2',
]
];
return response()->json(['product' => $product, 'materials' => $product_materials]);
after that axios request should be like this
this.axios
.get(`/api/products/calculate/${this.$route.params.id}`)
.then((res) => {
this.product = res.data.product;
this.product_materials = res.data.materials;
});
I hope it's helpful
return response()->json({
"product": $product,
"product_materials": $product_materials
});
You can achieve it by simply assigning the response data in the respective data properties and then bind that in the template.
Working Demo :
new Vue({
el: '#app',
data: {
product: {},
product_materials: []
},
mounted() {
const apiResponse = [{
"id": 5,
"name": "Bed",
"description": "Single",
"quantity": 1
}, {
"7": {
"id": 8,
"product_id": 5,
"description": "Wood"
},
"8": {
"id": 9,
"product_id": 5,
"description": "Mattress"
}
}];
apiResponse.forEach((obj) => {
if (obj.hasOwnProperty('name')) {
this.product = obj
} else {
Object.keys(obj).forEach((objKey) => {
this.product_materials.push(obj[objKey])
})
}
});
console.log('this.product', this.product);
console.log('this.product_materials', this.product_materials);
}
})
table, th, tr, td {
border: 1px solid black;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<h3>Product Details</h3>
<p> {{ product.name }} </p>
<p> {{ product.description }} </p>
<p> {{ product.quantity }} </p>
<h3>Product Material Details</h3>
<table>
<tr>
<th>Product ID</th>
<th>Description</th>
</tr>
<tr v-for="item in product_materials" :key="item.id">
<td>{{ item.product_id }}</td>
<td>{{ item.description }}</td>
</tr>
</table>
</div>
When sending the layout to Outlook 2016 it takes the multi-column table section and shrinks the width of the left and right (possibly increasing the width of the spacer center column too).
Have tried to add a spacer image at the bottom of each column to keep the width, but don't want those to have to load/soak up the file size. depending on the number of rows I add.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml "
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name=”x-apple-disable-message-reformatting”>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
/*////// CLIENT-SPECIFIC STYLES //////*/
.ReadMsgBody{width:100%;} .ExternalClass{width:100%;} /* Force Hotmail/Outlook.com to display emails at full width. */
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div{line-height:100%;} /* Force Hotmail/Outlook.com to display line heights normally. */
table, td{mso-table-lspace:0pt; mso-table-rspace:0pt;} /* Remove spacing between tables in Outlook 2007 and up. */
#outlook a{padding:0;} /* Force Outlook 2007 and up to provide a "view in browser" message. */
img{-ms-interpolation-mode: bicubic;} /* Force IE to smoothly render resized images. */
body, table, td, p, a, li, blockquote{-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%;} /* Prevent Windows- and Webkit-based mobile platforms from changing declared text sizes. */
/* CLIENT-SPECIFIC STYLES */
body, table, td, a { -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
table, td { mso-table-lspace: 0pt; mso-table-rspace: 0pt; }
img { -ms-interpolation-mode: bicubic; }
/* RESET STYLES */
img { max-width: 100% !important; height:auto !important; border: 0; line-height: 100%; outline: none; text-decoration: none; }
table { border-collapse: collapse !important; }
body { margin: 0 !important; padding: 0 !important; width: 100% !important; min-width:100% !important;}
/* iOS BLUE LINKS */
a[x-apple-data-detectors] {
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
*[class=table]
{
max-width: 600px !important;
width: 100% !important;
border-collapse: collapse !important;
height:auto !important; }
/* MOBILE STYLES */
#media only screen and (max-device-width: 480px)
{
.img-max {
width: 100% !important;
max-width: 100% !important;
height: auto !important;
}
.max-width {
width: 100% !important;
max-width: 100% !important;
border-collapse: collapse !important;
height:auto !important;
}
.mobile-wrapper {
width: 100% !important;
max-width: 100% !important;
height:auto !important;
}
.mobile-padding {
padding-left: 5% !important;
padding-right: 5% !important;
}
.img-social {
width: 15% !important;
max-width: 50% !important;
height: auto !important;
}
*[class=stack]
{
display: block !important;
}
}
/* ANDROID CENTER FIX */
div[style*="margin: 16px 0;"] { margin: 0 !important; }
#actual-table { border-collapse: collapse; }
#actual-table td {
width: 20%;
padding: 10px;
vertical-align: top;
}
#actual-table td:nth-child(even) {
background: #ccc;
}
#actual-table td:nth-child(odd) {
background: #eee;
}
</style>
</head>
<body style="text-align:center; margin: 0 !important; padding: 0; !important;" >
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top" width="100%" background="bg.jpg" style="background-size: cover; padding: 0;background: #999999;" bgcolor="#999999" class="mobile-wrapper">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px;" >
<tr>
<td align="center" valign="top" style="padding: 0;">
<table cellpadding="0" cellspacing="0" width="100%"><tr><td><table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px;">
<tr>
<td align="left" valign="top" style="padding-top:8px;padding-bottom:5px;">
<font face="Arial, Verdana, Helvetica, sans-serif" color="#000000" font="" size="1">View in browser</font> <font face="Arial, Verdana, Helvetica, sans-serif" color="#000000" font="" size="1">Link to Forward To A Friend</font> </td></tr>
</table></td></tr></table>
<table cellpadding="0" cellspacing="0" width="100%"><tr><td> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px;">
<tr>
<td align="center" valign="top" style="padding:0;">
<img src="" class="banner" style="display:block;" />
</td>
</tr>
</table></td></tr></table>
</td>
</tr></table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
<tr>
<td align="center" height="100%" valign="top" width="100%" style="background-color: #999999;" bgcolor="#999999" class="mobile-wrapper">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table cellpadding="0" cellspacing="0" width="100%"><tr><td><table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px;">
<tr>
<td class="stack" align="center" valign="top" style="padding-top:10px;padding-right:10px;padding-left:10px;padding-bottom:10px;background-color:#F4BB8A;" bgcolor="#F4BB8A">
<font face="Times New Roman, Times, serif" color="#000000" font="" size="4"><strong>Add A Headline To Announce Your Main Topic</strong></font></td></tr>
<tr>
<td class="stack" align="left" valign="top" style="padding-top:10px;padding-right:10px;padding-left:10px;padding-bottom:10px;background-color:#F6F7F3;" bgcolor="#F6F7F3"><font face="Arial, Verdana, Helvetica, sans-serif" color="#000000" font="" size="3">
Add a brief message. If readers need to know more than you can fit here, add a link to an outside resource that covers the rest.<br />
THE MAXIMUM SIZE FOR IMAGES IN THIS SECTION IS 580px WIDE.
</font>
</td>
</tr>
<tr>
<td align="left" valign="top" style="padding:10px;background-color:#999999;" bgcolor="#999999">
</td>
</tr>
</table></td></tr></table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
<tr>
<td align="center" height="100%" valign="top" width="100%" style="background-color: #999999;" bgcolor="#999999" >
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px;" >
<tr>
<td align="center" valign="top" style="font-size:0;">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600" id="actual-table">
<tr>
<td align="left" valign="top" width="280" style="background-color: #999999;" bgcolor="#999999" >
<![endif]-->
<div style="display:inline-block; max-width:50%; min-width:280px; vertical-align:top; width:100%; height:100%;background-color: #999999;" bgcolor="#999999" class="mobile-wrapper">
<table cellpadding="0" cellspacing="0" width="100%"><tr><td><table align="center" border="0" cellpadding="0" cellspacing="0" width="280" style="max-width:280px;" class="max-width">
<tbody>
<tr>
<td align="center" valign="top" style="padding-bottom:10px;background-color:#999999;" bgcolor="#999999"> </td>
</tr>
<tr>
<td align="left" valign="top" style="padding:10px;background-color:#393B63;" bgcolor="#393B63">
<font face="Times New Roman, Times, serif" color="#F6F7F3" size="3"><strong>I ♥ Email</strong></font></td>
</tr>
<tr>
<td align="left" valign="top" style="padding:10px;background-color:#F6F7F3;" bgcolor="#F6F7F3"><font face="Arial, Verdana, Helvetica, sans-serif" color="#000000" size="2">Include article copy. Be sure to make the articles short and concise. People tend to only read a couple of paragraphs at a time.<br />
<br />
THE MAXIMUM SIZE FOR IMAGES IN THIS SECTION IS 260px WIDE.<br />
<br />
When editing sections from copied mailings, delete old messages by clicking the red X, move messages up or down in order of importance by clicking the blue up and down arrows and add new sections by clicking the add section here (green '+' icon).</font></td>
</tr>
<tr>
<td align="left" valign="top" style="padding:10px;background-color:#999999;" bgcolor="#999999">
</td>
</tr>
</tbody>
</table></td></tr></table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
<td width="20" style="padding:0; font-size: 1px;"> </td>
<td align="right" valign="top" width="280" style="background-color: #999999;" bgcolor="#999999" >
<![endif]-->
<div style="display:inline-block; max-width:50%; min-width:280px; vertical-align:top; width:100%; height:100%;background-color: #999999;" bgcolor="#999999" class="mobile-wrapper">
<table cellpadding="0" cellspacing="0" width="100%"><tr><td><table align="center" border="0" cellpadding="0" cellspacing="0" width="280" style="max-width:280px;" class="max-width">
<tbody>
<tr>
<td align="center" valign="top" style="padding-bottom:10px;background-color:#999999;" bgcolor="#999999"> </td>
</tr>
<tr>
<td align="left" valign="top" style="padding:10px;background-color:#393B63;" bgcolor="#393B63">
<font face="Times New Roman, Times, serif" color="#F6F7F3" size="2"><strong>I ♥ Email</strong></font></td>
</tr>
<tr>
<td align="left" valign="top" style="padding:10px;background-color:#F6F7F3;" bgcolor="#F6F7F3"><font face="Arial, Verdana, Helvetica, sans-serif" color="#000000" size="2">Include article copy. Be sure to make the articles short and concise. </font>
</td>
</tr>
<tr>
<td align="left" valign="top" style="padding:10px;background-color:#999999;" bgcolor="#999999">
</td>
</tr>
</tbody>
</table></td></tr></table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
<tr>
<td align="center" height="100%" valign="top" width="100%" bgcolor="#999999" style="background: #999999;padding: 0;">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table cellpadding="0" cellspacing="0" width="100%"><tr><td><table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px;">
<tr>
<td class="stack" align="left" valign="top" style="padding-top:10px;padding-right:10px;padding-left:10px;padding-bottom:10px;background-color:#F4BB8A;" bgcolor="#F4BB8A">
<font face="Times New Roman, Times, serif" color="#000000" font="" size="3"><strong>Design emails people love</strong></font></td></tr>
<tr>
<td class="stack" align="!3BODYFONTALIGN!" valign="top" style="padding-top:10px;padding-right:10px;padding-left:10px;padding-bottom:10px;background-color:#FFFFFF;" bgcolor="#FFFFFF"><font face="Arial, Verdana, Helvetica, sans-serif" color="#000000" font="" size="2">Include article copy. Be sure to make the articles short and concise. People tend to only read a couple of paragraphs at a time.<br /><br />
THE MAXIMUM SIZE FOR IMAGES IN THIS SECTION IS 580px WIDE.
</font>
</td>
</tr>
<tr>
<td align="left" valign="top" style="padding:10px;background-color:#999999;" bgcolor="#999999">
</td>
</tr>
</table>
</td></tr></table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
<tr>
<td align="center" height="100%" valign="top" width="100%" bgcolor="#0F0D35" style="background: #0F0D35;padding: 0;">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table cellpadding="0" cellspacing="0" width="100%"><tr><td><table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px;">
<tr>
<td class="stack" align="center" valign="top" style="padding:10px;background-color:#0F0D35;" bgcolor="#0F0D35">
<font face="Arial, Verdana, Helvetica, sans-serif" color="#FFFFFF" font="" size="2"></font></td>
</tr>
</table></td></tr></table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
<tr>
<td align="center" height="100%" valign="top" width="100%" style="background-color: #0F0D35;" bgcolor="#0F0D35" class="mobile-wrapper">
<!--[if (gte mso 9)|(IE)]>
<table align="center" border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
<table width="600" border="0" cellspacing="5" cellpadding="5"> <tr> <td colspan="3"> <hr align="left" width="100%" noshade> <p> <font size="-2" face="Verdana, Arial, Helvetica, sans-serif" color= "#FFFFFF"><strong>Generated by</strong></font> <img src= "https://images.marketvolt.com/mv_gif_transparent.gif" width="60" height="55" hspace="4" vspace="0" border="0" align="middle"><font size="-2" face= "Verdana, Arial, Helvetica, sans-serif" color= "#FFFFFF"><strong>Learn more</strong></font> </p> </td> </tr></table><img width="1" height="1" src="https://images.marketvolt.com/space.gif">
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
</body>
</html>
When I insert the HTML file into outlook and then view it, it looks all stretched vertically, but when viewing it on the browser it looks perfect.
When I view the email signature in the outlook "Signatures and Stationary" window it also looks right but when inserting it into the body of the email message it gets stretched.
Taken all the height property out of HTML code.
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Wagma E-Signature</title>
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Raleway:100,200,400,500,600,700,800,900" />
<style type="text/css">
/* Client-Specific styles */
#outlook a { padding:0; } /* Force Outlook to provide a "view in browser" menu link. */
body { width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0; border:0; }
/* Prevent Webkit and Windows Mobile platforms from changing default font sizes, while not breaking desktop design. */
.ExternalClass { width:100%; } /* Force Hotmail to display emails at full width */
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div { line-height:100%; } /* Force Hotmail to display normal line spacing.*/
img { outline:none; text-decoration:none;border:none; -ms-interpolation-mode:bicubic; }
a img { border:none; text-decoration:none;border:none; -ms-interpolation-mode:bicubic; }
p { margin:0px 0px !important; }
table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
table td { border-collapse:collapse; }
/* iPad Styles */
#media only screen and (max-width: 640px) {
a[href^="tel"], a[href^="sms"] {
text-decoration:none;
color:#000000;
pointer-events:none;
cursor:default;
}
.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
text-decoration:default;
color:#000000 !important;
pointer-events:auto;
cursor:default;
}
}
/* iPhone Styles */
#media only screen and (max-width: 480px) {
a[href^="tel"], a[href^="sms"] {
text-decoration:none;
color:#000000;
pointer-events:none;
cursor:default;
}
.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
text-decoration:default;
color:#000000 !important;
pointer-events:auto;
cursor:default;
}
}
/* Responsive styles */
#media only screen and (max-width: 480px) {
td[class=wrapper] {
padding-top:0 !important;
padding-left:0 !important;
padding-right:0 !important;
}
table[class=mobile-view], td[class=mobile-view], img[class=mobile-view] {
width:320px !important;
height:auto !important;
}
td[class=clump] {
display:block !important;
padding-left:0 !important;
padding-right:0 !important;
width:100% !important;
}
td[class=aligncenter] {
width:300px !important;
height:auto !important;
text-align:center !important;
}
}
</style>
</head>
<body>
<table width="490" border="0" cellspacing="0" cellpadding="0" class="mobile-view" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tbody>
<tr>
<td>
<table width="490" border="0" cellspacing="0" cellpadding="0" class="mobile-view" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tbody>
<tr>
<td width="130" align="left" valign="top" class="clump" style="padding:0 0 10px 0; background:#eff1f6;">
<!-- Add your Avatar -->
<img src="image/LOGO-WAGMA 320 X 320.png" alt="Avatar" border="0" width="120" style="padding:10px 0 0 10px; display:block; border:0; outline:none;" />
</td>
<td width="360" align="left" valign="top" class="clump" style="padding:10px 0 0 0; background:#eff1f6;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tbody>
<tr>
<td style="padding:0 10px 0 15px;" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tr>
<!-- Edit your Name or Title -->
<td style="font-family:'Raleway', sans-serif, Arial; font-size:18px; line-height:24px; font-weight:900; color:#2f3542; padding:10px 0 0 0;">Andrew Magombedze</td>
</tr>
<tr>
<!-- Edit your job title or subtitle -->
<td style="font-family:'Raleway', sans-serif, Arial; font-size:12px; line-height:18px; font-weight:500; color:#6e7482; padding:0 0 10px 0;">SHEQ Consultant</td>
</tr>
<!-- Edit your job title or subtitle -->
<tr>
<td style="font-family:'Raleway', sans-serif, Arial; font-size:10px; line-height:12px; font-weight:400; color:#6e7482; padding:0 0 10px 0;">Bsc (Hons) Enviro, SAMTRAC<br>ISO 14001, 18001 Implementation<br>ISO 14001, 18001 Internal Auditor<br>Sacpcmp - CanCHSM</td>
</tr>
<tr>
<!-- Edit your Address -->
<td style="font-family:'Raleway', sans-serif, Arial; font-size:12px; line-height:18px; font-weight:600; color:#2f3542; padding:5px 0 0 0;">Office 192 Woodlands Gardens, 92 Bellairs Drive, Northriding, Randburg</td>
</tr>
<tr>
<!-- Edit your website's URL -->
<td style="font-family:'Raleway', sans-serif, Arial; font-size:16px; line-height:30px; font-weight:800; color:#60d853; padding:0 0 10px 0;">Wagma-SHEQ.co.za</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="490" border="0" cellspacing="0" cellpadding="0" class="mobile-view" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tbody>
<tr>
<td width="63%" style="padding:12px 0 5px 10px; background:#e1e4ed;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tbody>
<tr>
<td width="50%" class="clump">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tbody>
<tr>
<td width="25" valign="top"><img src="image/icon_green_phone.png" alt="Phone" border="0" width="22" style="display:block; border:0; outline:none;" /></td>
<!-- Edit your Phone number -->
<td width="" valign="top" align="left" style="font-family:'Raleway', sans-serif, Arial; font-size:12px; line-height:24px; font-weight:600; color:#2f3542;"> +27 78 762 7712</td>
</tr>
</tbody>
</table>
</td>
<td width="50%" class="clump">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
<tbody>
<tr>
<td width="25" valign="top"><img src="image/icon_green_email.png" alt="Email" border="0" width="22" style="display:block; border:0; outline:none;" /></td>
<!-- Edit your Email address -->
<td width="" valign="top" align="left" style="font-family:'Raleway', sans-serif, Arial; font-size:12px; line-height:24px; font-weight:600; color:#2f3542;">andrewm#wagma-sheq.co.za</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>
It looks like you need to specify your height attribute too on the images.
So for example instead of this:
<img src="image/LOGO-WAGMA 320 X 320.png" alt="Avatar" border="0" width="120"
style="padding:10px 0 0 10px; display:block; border:0; outline:none;" />
Try:
<img src="image/LOGO-WAGMA 320 X 320.png" alt="Avatar" border="0" width="120"
height="120" style="padding:10px 0 0 10px; display:block; border:0; outline:none;" />
If you need to cater for mobile responsiveness, you treat the width and height attributes as default (for Outlook), and an inline style for everything else:
<img src="image/LOGO-WAGMA 320 X 320.png" alt="Avatar" border="0" width="120"
height="120" style="width:120px;height:auto;max-width:120px; padding:10px 0 0 10px; display:block; border:0; outline:none;" />
I have a web version that's displaying fine. When I send a test email, it shows unwanted spacing between the images. I tried changing the the padding and margin , but nothing's working. Why is it doing that?
https://jsfiddle.net/tantalizea/r49oqbjj/
CSS:
a,
body,
div,
img,
span,
table,
td,
tr {
margin: 0;
padding: 0;
border: 0;
}
a {
color: #231F20;
font-weight: bold;
text-decoration: none
}
a[href^="x-apple-data-detectors:"] {
color: inherit;
text-decoration: inherit;
}
area {
outline: none
}
body {
font: normal 100% Arial, Helvetica, sans-serif;
background: #FFF;
color: #231F20
}
img {
border: none;
width: 100%;
height: auto
}
.container {
width: 600px;
margin: 0 auto;
max-width: 600px
}
#preheader {
display: none !important;
visibility: hidden;
opacity: 0;
color: #FFFFFF;
color: transparent;
height: 0;
width: 0;
font-size: 0px
}
.desktop {
display: table !important;
margin: 0 auto !important;
}
tr.desktop {
display: table-row !important
}
td.desktop {
display: table-cell !important
}
img.desktop {
display: inline !important
}
.mobile {
display: none !important
}
.break {
display: inline !important
}
#media screen and (max-width: 600px) {
.container {
width: 97.5%
}
.desktop,
tr.desktop,
td.desktop,
img.desktop {
display: none !important
}
.mobile {
display: table !important
}
tr.mobile {
display: table-row !important
}
td.mobile2 {
display: table !important;
width: 100%;
text-align: center !important
}
td.mobile {
display: table-cell !important
}
.break {
display: none !important
}
.hidden {
display: none !important
}
.no-border {
border: none !important
}
.smaller {
font-size: 200% !important
}
.smaller2 {
font-size: 100% !important
}
.center {
text-align: center !important
}
.margin {
margin: 0 auto
}
.image {
width: 100px !important
}
.width-100 {
width: 100% !important
}
}
HTML:
<body style="background:#FFF; color:#858585">
<div id="preheader" style="display:none; visibility:hidden; opacity:0; color:#878787; color:transparent; height:0; width:0; font-size:0px;">Tuesday, March 7, 2017 | 9840 International Drive, Orlando, Florida | Booth #613</div>
<!-- /div#preheader -->
<div class="container" style="margin:0 auto; max-width:600px">
<table cellpadding="0" cellspacing="0" border="0" align="center" class="container" style="margin:0 auto; max-width:600px">
<tr class="bronto">
<td height="20"></td>
</tr>
<tr class="bronto">
<td align="center"><span style="font:normal 68.75% Helvetica, Arial, sans-serif; color:#858585">Is this email not displaying correctly? Try the web version.</span></td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" align="center" border="0" width="100%">
<tr>
<td height="20"></td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" align="center" border="0" width="100%">
<tr>
<td width="35" class="desktop"> </td>
<td align="center">
<table cellpadding="0" cellspacing="0" align="center" border="0" width="100%">
<tr>
<td align="left" valign="bottom" width="76%"><span style="font:normal 300% Times, 'Times New Roman', serif; color:#56565a; line-height:100%" class="smaller"><strong><em>You're Invited!</em></strong></span></td>
<td style="text-align:right" width="24%"><img src="http://www.kravetcontract.com/email_blasts/tipin.png" alt="KK" style="max-width:144px; width:100%" /></td>
</tr>
</table>
</td>
<td width="35" class="desktop"> </td>
</tr>
<!--<tr class="mobile">
<td class="mobile">
<table cellpadding="0" cellspacing="0" align="center" border="0" width="100%" class="mobile">
<tr class="mobile">
<td height="20" class="mobile"></td>
</tr>
<tr class="mobile">
<td align="center" class="mobile"><span style="font:normal 200% Times, 'Times New Roman', serif; color:#57565b;" class="mobile"><strong><em>You're Invited!</em></strong></span></td>
</tr>
</table>
</td>
</tr>-->
</table>
</td>
</tr>
<tr>
<td height="20"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" valign="top"><img src="http://www.kravetcontract.com/email_blasts/newh-2017/top.jpg" alt="Top" style="max-width:600px" /></td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" align="center" border="0" width="100%">
<tr>
<td align="left" valign="middle" class="desktop" width="78"><img src="http://www.kravetcontract.com/email_blasts/newh-2017/left.jpg" alt="Left" style="max-width:78px" /></td>
<td align="center" valign="middle" bgcolor="#FFFFFF">
<table cellpadding="0" cellspacing="20" align="center" border="0" width="100%">
<tr>
<td align="center"><span style="font:normal 100% Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif; color:#101011; letter-spacing:1px">PLEASE JOIN</span></td>
</tr>
<tr>
<td align="center"><img src="http://www.kravetcontract.com/email_blasts/BDNY2016/logo.png" alt="kravetcontract" style="max-width:280px" /></td>
</tr>
<tr>
<td align="center"><span style="font:normal 100% Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif; color:#101011; letter-spacing:1.5px">AT THIS YEAR'S</span></td>
</tr>
<tr>
<td align="center"><img src="http://www.kravetcontract.com/email_blasts/newh-2017/newh_logo_2.png" alt="NEWH" style="max-width:192px" /></td>
</tr>
<tr>
<td align="center" valign="middle"><span style="font:normal 100% Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif; color:#101011;letter-spacing:1.5px">MARCH 7, 2017 AT 12PM-6PM<br />
BOOTH #613</span></td>
</tr>
<tr>
<td align="center" valign="middle"><span style="font:normal 81.25% Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif; color:#101011; letter-spacing:1.5px">9840 International Drive<br />
Orlando, Florida</span></td>
</tr>
<tr>
<td align="center"><span style="font:normal 100% Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif; color:#101011; line-height:21px; letter-spacing:1.5px">We look forward to seeing you.</span></td>
</tr>
</table>
</td>
<td align="right" valign="middle" class="desktop" width="78"><img src="http://www.kravetcontract.com/email_blasts/newh-2017/right.jpg" alt="Right" style="max-width:78px" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" valign="top"><img src="http://www.kravetcontract.com/email_blasts/newh-2017/bottom.jpg" alt="Bottom" style="max-width:600px" /></td>
</tr>
<tr>
<td align="center" valign="middle" bgcolor="#56565a">
<table cellpadding="0" cellspacing="5" align="center" border="0">
<tr>
<td bgcolor="#56565a">GET DIRECTIONS <strong style="font-family:Arial, sans-serif;">►</strong></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="20"></td>
</tr>
<tr>
<td><img src="http://www.kravet.com/style-spotlight/one-family.gif" alt="One Family. Ninety-Eight Years." border="0" style="border:none; width:100%" /></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td align="center"><span style="font:normal 150% Helvetica, Arial, sans-serif; color:#858585"><span style="font:normal 87.5%/4mm Helvetica, Arial, sans-serif; color:#858585">#</span>kravetinc</span>
</td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td align="center">
<table cellpadding="0" cellspacing="0" align="center" border="0">
<tr>
<td>
<img src="http://www.kravet.com/style-spotlight/instagram.gif" alt="Instagram" border="0" style="border:none; width:100%; max-width:50px" />
</td>
<td width="10"> </td>
<td>
<img src="http://www.kravet.com/style-spotlight/facebook.gif" alt="Facebook" border="0" style="border:none; width:100%; max-width:50px" />
</td>
<td width="10"> </td>
<td>
<img src="http://www.kravet.com/style-spotlight/pinterest.gif" alt="Pinterest" border="0" style="border:none; width:100%; max-width:50px" />
</td>
<td width="10"> </td>
<td>
<img src="http://www.kravet.com/style-spotlight/twitter.gif" alt="Twitter" border="0" style="border:none; width:100%; max-width:50px" />
</td>
<td width="10"> </td>
<td>
<img src="http://www.kravet.com/style-spotlight/houzz.gif" alt="Houzz" border="0" style="border:none; width:100%; max-width:50px" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td align="center">e-designtrade.com</td>
</tr>
<tr>
<td height="40"></td>
</tr>
<tr>
<td align="center"><span style="font:normal 75% Helvetica, Arial, sans-serif; color:#858585">KRAVET® INC | CONTACT US | PRIVACY POLICY</span></td>
</tr>
<tr>
<td align="center"><span style="font:bold 75% Helvetica, Arial, sans-serif; color:#858585">Exclusively Available Through Interior Designers</span></td>
</tr>
<tr>
<td height="40"></td>
</tr>
<tr class="bronto">
<td align="center"><span style="font: normal 68.75% Helvetica, Arial, sans-serif; color: #858585;" xml="lang">This email was sent to %%!contact_email%% by %%!account_organization%%</span></td>
</tr>
<tr class="bronto">
<td align="center"><span style="font: normal 68.75% Helvetica, Arial, sans-serif; color: #858585;" xml="lang">%%!account_address1%% | %%!account_city%%, %%!account_state%% %%!account_zip%%</span></td>
</tr>
<tr class="bronto">
<td align="center"><span style="font:normal 68.75% Helvetica, Arial, sans-serif; color:#858585">Forward to a friend | Manage Preferences | Unsubscribe</span></td>
</tr>
<tr>
<td height="40"></td>
</tr>
</table>
<!-- /table.container -->
</div>
<!-- /div.container -->
</body>
Try using display block on all images.
style="display:block;"
This is a must have on all images.
Cheers
To be quite honest, I actually love the way it looks haha.
But I believe your issue is the img. It's based on the width. The aspect ratio makes the height smaller then the size of the table row. This is probably not the best way to fix it, but after going through a bunch of css changes I couldn't get it to work any other way:
On the specific images. Set the img style to be moved 4 px down:
transform: translateY(4px);
Bottom image, 4 px up:
transform: translateY(-4px);
Ex:
Bottom:
<img src="http://www.kravetcontract.com/email_blasts/newh-2017/bottom.jpg" alt="Bottom" style="max-width:600px;transform: translateY(-4px);">
Should look like this: