This example show you how to:
<select id="country_id" class="mSelect" multiple="multiple"></select>
$(function () {
$('#country_id').mSelect({
url: 'ajax/example4.php',
btnSelected:{
enable: true,
icon1: 'fa fa-filter',
icon2: 'fa fa-times',
color_icon1: 'blue',
color_icon2: 'red'
}
});
});
<?php
//........
// get the selected rows ids
$selectedIds = isset($_GET['ids']) && !empty($_GET['ids']) ? $_GET['ids'] : [];
$whereResult = !empty($selectedIds) ? "id IN($selectedIds)" : null;
echo json_encode(
Datatables::complex($_GET, $sql_details, $table, $primaryKey, $columns, $whereResult, $whereAll = null)
);
?>