I am using JQuery jTable plugin to display my table records.
$(document).ready(function () {
//Prepare jTable
$('#PeopleTableContainer').jtable({
title: 'Table of people',
paging: true,
pageSize: 2,
sorting: true,
defaultSorting: 'Name ASC',
actions: {
listAction: 'PersonActionsPagedSorted.php?action=list',
createAction: 'PersonActionsPagedSorted.php?action=create',
updateAction: 'PersonActionsPagedSorted.php?action=update',
deleteAction: 'PersonActionsPagedSorted.php?action=delete'
},
fields: {
PersonId: {
key: true,
create: false,
edit: false,
list: false
},
Name: {
title: 'Author Name',
width: '40%'
},
Age: {
title: 'Age',
width: '20%'
},
RecordDate: {
title: 'Record date',
width: '30%',
type: 'date',
create: false,
edit: false
},
Photo: {
title: 'Photo',
width: '50%',
type: 'img',
create: false,
edit: false
}
}
});
//Load person list from server
$('#PeopleTableContainer').jtable('load');
});
The last column as you can see is Photo. I have stored Photo path in corresponding table in mysql table. I want to display image in last column. Is this possible using this plugin?
I am developing it in PHP.
Thanks.
This Should Solve Your Problem:
Photo: {
title: "Photo",
width: '50%',
edit: false,
create: false,
display: function (data) {
return '<img src=' + data.record.ImageURL + ' />';
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With