<?php
$cs = Yii::app()->getClientScript();
    ?>
<script>
    $(document).ready(function () {
        var table_id = "#tbl_user_details";
        var table = $(table_id).on("preXhr.dt", function (e, settings, data) {
            return data;
        }).DataTable({
            scrollY: "645px",
            pageLength: 50,
            processing: true,
            ajax: {
                url: "<?php echo Yii::app()->createUrl('users/GetList') ?>",
                type: "POST",
                cache: false,
            },
            serverSide: true,
            fixedColumns: true,
            processing: true,
            "fnCreatedRow": function (nRow, aData, iDataIndex) {
                $(nRow).addClass("context-menu");
            },
            "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
                AddContextMenu(nRow, aData);
            }
        });
    });
    function AddContextMenu(row, datas) {
        
        $(row).contextMenu({
            selector: 'td',

            items: {
                "edit": {
                    name: "Edit",
                    icon: "edit",
                    accesskey: "e",
                    callback: function () {
                        loadPopupModal("users/editUser&id=" + datas[4].id, datas[4].code, "lg");
                    }
                }
                

            }
        });
    }
</script>
    <section class="panel">
        <header class="panel-heading clearfix panel-theame">
            <i class="fa fa-users"></i> Users 
            <div class="pull-right">  </div>
        </header>
        <div class="panel-body">
            <div class="custom-data-table">
                <table class="table table-hover table-bordered personal-task" id="tbl_user_details" style="font-size:13px;">
                    <thead>
                        <tr>
                            <th>SI No</th>
                            <th>Code</th>
                            <th>Name</th>
                            <th>Designation</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
    </section>
