I am dealing with a JSON response array structured as follows:
var response2 = {
"response": {
"Data1": [{
codeImage: "605313c59050dc5fc1f3372c"
created_by: "23"
form_name: "default"
location: "station 1"
image_file: "605313c59050dc5fc1f3372c123a213.png"
image_url: "https://mysite:8241/products/view?code=605313c59050dc5fc1f3372c123a213"
_id: "605313c59050dc5fc1f3372c",
}],
"Data2": [{
codeImage: "605313fe3cdf045fbcf14be5"
created_by: "23"
form_name: "default"
location: "testing testing testing testing testing"
image_file: "605313c59050dc5fc1f3372c123a213.png"
image_url: "https://mysite:8241/products/view?code=605313c59050dc5fc1f3372c123a213"
_id: "605313fe3cdf045fbcf14be5",
}]
}}
To display the above data using Bootstrap cards, I attempted to use 'append' but encountered an issue where the card heights were not consistent due to the varying length of the 'location' values in Data1 and Data2.
Below is the code snippet for the 'append' function:
for (var i = 0; i < response2.response.length; i++)
{
var location = response2.response[i].location
var image= response2.response[i].image_url
var form_name = response2.response[i].form_name
var showImage=
'<div class="col-sm-12 col-md-4 col-xl-4 col-padding" style="padding-right:0px; padding-left:20px; display: table; width: 100%;">'+
'<div class="card card-custom card-stretch gutter-b card-padding">'+
'<div class="d-flex align-items-center row">'+
'<div class="col">'+
'<div class="col-sm-12 col-md-12 col-xl-12">'+
'<div class="text-muted mt-1">Location</div>'+
'<p class="text-dark font-weight-bolder font-size-lg mt-2">'+location+'</p>'+
'</div>'+
'<div class="col-sm-12 col-md-12 col-xl-12">'+
'<div class="text-muted mt-1">Form</div>'+
'<p class="text-dark font-weight-bolder font-size-lg mt-2">'+form_name+'</p>'+
'</div>'+
'</div>'+
'<div class="col">'+
'<div class="col-sm-12 col-md-12 col-xl-12">'+
'<img src="'+image+'" alt="" class="image-img">'+
'</div>'+
'</div>'+
'</div>'+
'<div class="row justify-content-center btn-margin" style="margin-left:-25px">'+
'<div class="col-sm-12 col-md-4 col-xl-4">'+
'<button class="btn btn-xl btn-light btn-full-width" style="margin-right:10px"><i class="fas fa-print"></i> Show Data</button>'+
'</div>'+
'<div class="col-sm-12 col-md-4 col-xl-4">'+
'<button class="btn btn-xl btn-primary btn-full-width" style="margin-right:10px"><i class="fas fa-edit"></i> Edit</button>'+
'</div>'+
'<div class="col-sm-12 col-md-4 col-xl-4" >'+
'<button class="btn btn-xl btn-danger btn-full-width" style="margin-right:10px; width: 100px;"><i class="fas fa-trash-alt"></i> Delete</button>'+
'</div>'+
'</div>'+
'</div>'+
'</div>';
$("#imagepadding").append(showImage);
}
The HTML structure required for the 'imagepadding' cards is shown below:
<div class="d-flex flex-column-fluid">
<div class="container addon-padding">
<div class="row" id="imagepadding">
</div>
</div>
</div>
I attempted to use 'h-100 card-body' within the 'card' div, but the issue remained unresolved. Can anyone advise on how to ensure that all bootstrap cards have the same height?
Thank you.