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

        var callBack = function() {
        };

        var datalist = jQ('#purchaseOrder-datalist').DataTable({
            'processing': true,
            'serverSide': true,
            'ajax': {
                'url': purchaseOrder.settings.ajaxUrl,
                'data': function(d) {
                    d.status = jQ('#purchaseOrderFilter-status').val();
                    d.branch = jQ('#purchaseOrderFilter-branch').val();
                    d.url = global.settings.url;
                }
            },
            'columnDefs': [
                { 'orderable': false, 'targets': [2, 7] },
                { 'searchable': false, 'targets': [2, 7] }
            ],
            order: [[1, 'desc']],
            drawCallback: callBack,
            responsive: {
                details: {
                    renderer: function(api, rowIdx) {
                        return global.dataTableResponsiveCallBack(api, rowIdx, callBack);
                    }
                }
            }
        });

        jQ('#purchaseOrderFilter-status').change(datalist.draw);
        jQ('#purchaseOrderFilter-branch').change(datalist.draw);

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