Click here to Skip to main content
13,147,383 members (26,769 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
<script type="text/javascript">
        $(document).ready(function () {
            $("#tblJQGrid").jqGrid(
            {
                url: 'Default/GetDataForEmployeeJQGrid',
                datatype: "json",
                reloadAfterSubmit: true,
                contentType: "application/json; charset-utf-8",
                mtype: 'GET',
                colNames: ['TaskId', 'EmployeeId', 'Name'],
                colModel: [
                { name: 'TaskId', index: 'TaskId', width: 50, stype: 'text' },
                { name: 'EmployeeId', index: 'EmployeeId', width: 20, stype: 'text', editable: true, editoptions: { dataEvents: [{ type: 'focusout', fn: function (e) { $('#HiddenNet').val(this.value); } }] }, editrules: { custom: false, } },
                { name: 'Name', index: 'Name', width: 150, editable: true, editoptions: { dataEvents: [{ type: 'focusout', fn: function (e) { $('#HiddenNet').val(this.value); } }] }, editrules: { custom: true, } }],                
                editurl: "/Default/GridEdit",
                pager: jQuery('#listpager'),
                rowNum: 10,
                rowList: [5, 10, 20, 50],
                sortname: 'Id',
                sortorder: "desc",
                viewrecords: true,
                caption: "List Employee Details"
            });
            
 
            jQuery("#tblJQGrid").jqGrid('navGrid', '#listpager', {                
                edit: true,
                add: true,
                del: true,
                search: true,
                refresh: true,
            },
            {   //edit record form            
                url: "/Default/GridEdit/", closeAfterEdit: true, beforeShowForm: function (formid) { $("#Id",formid).hide(); }                
            },
            {   //new record form
                closeAfterAdd: true,
                recreateForm: true,
                viewPagerButtons: false
            },
            {   //delete record form
                recreateForm: true
            });
            $("#tblJQGrid").setGridWidth(Math.round($(window).width()-100, true));
            $('.ui-pg-button').on('click', function (ev) {
                ClickEventId = this.id;
            });
        });
 
    </script>
Posted 4-Nov-15 18:06pm
Updated 4-Nov-15 18:31pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 5 Nov 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100