Example 05:

This example show you how to:

  • Load the plugin
  • Custom the Selected button in the Example 4

HTML :
<select id="country_id" class="mSelect" multiple="multiple"></select>
JS :
$(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 :
<?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)
    );
?>