{"size": 2907, "ext": "js", "max_stars_repo_path": "BookingSystem.WebUI/Scripts/pages/Dashboard/auditloglist.js", "max_stars_repo_name": "Gestotudor/Mvc_Hotel_Booking", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "BookingSystem.WebUI/Scripts/pages/Dashboard/auditloglist.js", "max_issues_repo_name": "Gestotudor/Mvc_Hotel_Booking", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "BookingSystem.WebUI/Scripts/pages/Dashboard/auditloglist.js", "max_forks_repo_name": "Gestotudor/Mvc_Hotel_Booking", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 33.4137931034, "max_line_length": 173, "alphanum_fraction": 0.4647402821}
﻿var AuditLogList = function () {
    var that = this;
    var pageInitObject = [];

    var fillGrid = function () {
        var table = $('#tableAuditLogList');

        if (!jQuery().DataTable) {
            return;
        }

        table.dataTable({
            "searching": false,
            "responsive": false,
            "paging": true,
            "processing": true, // for show progress bar
            "serverSide": true, // for process server side
            "filter": true, // this is for disable filter (search box)
            "orderMulti": false, // for disable multiple column at once
            "pageLength": 10,
            buttons: [
            ],
            "dom": "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>", 
            "ajax": {
                "url": that.pageInitObject.urls.gridLoadUrl,
                "contentType": "application/json",
                "datatype": "json",
                "type": "POST",
                "data": function (data) {
                    var req = Core.buildModel();
                    data.FilterRequest = req;

                    var request = {
                        model: data
                    };
                    return JSON.stringify(request);
                },
                "dataFilter": function (data) {
                    return data;
                    // var json = JSON.stringify jQuery.parseJSON(data);
                    // return json.data;
                }
            },
            "columns": [
                { "data": "Id", "name": "Id", "bSortable": false, "sWidth": "0" },
                { "data": "SessionId", "name": "SessionId", "bSortable": false, "Width": "10" }
            ],
            "columnDefs": [

            ]
        });
    };

    var refreshGrid = function () {
        var tbl = $('#tableAuditLogList').DataTable();
        tbl.ajax.reload();
    }

    var handleStartup = function () {
        $('.box.box-default').boxWidget('toggle');
    };

    var handleEvents = function () {
        $(document).on('click', '.btnClear', function () {
            Core.clearForm();
            refreshGrid();
            // $('#tableAuditLogList').DataTable().rows('.selected').deselect();
        });
    };

    return {
        init: function (initObject) {
            // diğer js 'ler de url'leri direk nesne olarak göndermiştik. Model gibi düşünebilirsiniz.
            // Burada ise Array objeler halinde gönderildi.
            // List veya array gibi düşünülebilir.
            // ChromeDev Console üzerinden değişkeni çağırıp inceleyiniz.
            that.pageInitObject = initObject;

            if (!jQuery().dataTable) {
                return;
            }
            fillGrid();
            handleEvents();
            handleStartup();
        }
    };
}();