I have bootstrap table which fetches data from mysql db where I am having Boolean values which I want to display as YES or NO instead of 1 or 0 in my bootstrap table. My JS bootstrap table code
var $table = $('#table');
$table.bootstrapTable({
url: 'list-user.php',
search: true,
pagination: true,
buttonsClass: 'primary',
showFooter: true,
minimumCountColumns: 2,
columns: [{
field: 'num',
title: '#',
sortable: true,
}, {
field: 'first',
title: 'Available',
sortable: true,
},],
});
I am a learner, tried various online solutions but couldn't make it work.
Use the formatter function - for example
function formatYesNo(value,row,index){
return value==0 ? 'No' : 'Yes';
}
Define your column formatter like this:
formatter: formatYesNo,