Skip to content

Instantly share code, notes, and snippets.

@craigerskine
Created August 17, 2017 14:43
Show Gist options
  • Save craigerskine/cecbee27d525553b340762f94c9336d6 to your computer and use it in GitHub Desktop.
Save craigerskine/cecbee27d525553b340762f94c9336d6 to your computer and use it in GitHub Desktop.
$(function(){
// table
var table_data = [
{
name: '<a href="#">Some name</a>',
id: '1'
}
]
$('#table-bootstrap').bootstrapTable({
data: table_data,
iconsPrefix: 'fa',
icons: {
paginationSwitchDown: 'fa-chevron-down',
paginationSwitchUp: 'fa-chevron-up',
refresh: 'fa-refresh',
toggle: 'fa-list-alt',
columns: 'fa-columns',
detailOpen: 'fa-plus',
detailClose: 'fa-minus'
}
}).on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function(){
$('#remove').prop('disabled', !$(this).bootstrapTable('getSelections').length);
});
$('#remove').click(function(){
var ids = $.map($('#table-bootstrap').bootstrapTable('getSelections'), function(row){
return row.id
});
$('#table-bootstrap').bootstrapTable('remove', {
field: 'id',
values: ids
});
$('#remove').prop('disabled', true);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment