var inventory = {
    settings: {
        ajaxUrl: ''
    },
    init: function() {
        inventory.initDataTable();
    },
    initDataTable: function() {

        var callBack = function() {
        };

        var dataList = jQ('#inventory-datalist').DataTable({
            
            'processing': true,
            'serverSide': true,
            'ajax': {
                'url': inventory.settings.ajaxUrl,
                'data': function(d) {
                    d.url = global.settings.url;
                    d.branchId = jQ('#inventoryFilter-branch').val();
                    d.locationId = jQ('#inventoryFilter-location').val();
                    d.status = jQ('#inventoryFilter-status').val();
                }
            },
            'order' : [[2,'asc']],
            'columnDefs': [
                { 'orderable': false, 'targets': 5 },
                { 'searchable': false, 'targets': 5 }
            ],
            drawCallback: function() {
                callBack();
            },
            responsive: {
                details: {
                    renderer: function( api,rowIdx ) {
                        return global.dataTableResponsiveCallBack(api, rowIdx, callBack);
                    }
                }
            }
        });

        jQ('#inventoryFilter-branch, #inventoryFilter-location, #inventoryFilter-status').change(function(){
            dataList.draw();
        });

        jQ('#inventoryFilter-location').chained('#inventoryFilter-branch');

        jQ('.content-container').removeClass('has-loading'); jQ('.content-container-content').removeClass('hide');
    }
};