jqgrid sample using array data, what am I missing

后端 未结 8 1620
别跟我提以往
别跟我提以往 2021-01-06 22:43

I\'m new in jqgrid, I\'m just trying thes example to work. I have a html file only, nothing more. When I ran this file, array data is not showing. What am I missing here? Th

相关标签:
8条回答
  • 2021-01-06 23:25

    This are the css and js to include that do the trick for me. Very important to include grid.base.js

    0 讨论(0)
  • 2021-01-06 23:25
    Try this friends
    <link rel="stylesheet" type="text/css" href="css/ui.jqgrid.css" />
    <script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
    <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    var mydata = [{
        Sno: "1",
        StudentName: "Ricky",
        DateOfJoining: "05/12/2014"
    }, {
        Sno: "3",
        StudentName: "Hyden",
        DateOfJoining: "06/12/2014"
    }, {
        Sno: "4",
        StudentName: "Gill Crist",
        DateOfJoining:"04/12/2014"
    }, {
        Sno: "2",
        StudentName: "Lee",
        DateOfJoining: "07/12/2014"
    }];
    
    $(function () {
        $("#grid").jqGrid({
            data: mydata,       
            datatype: "local",        
            colNames: ["Sno", "StudentName", "DateOfJoining"],
            colModel: [
                { name: "Sno", width: 100},
                { name: "StudentName", width: 160 },
                { name: "DateOfJoining", width: 150, align: "right" }           
            ],
            pager: "#pager",
            rowNum: 2,
            rowList: [1, 2, 3],
            sortname: "Sno",
            sortorder: "desc",
            viewrecords: true,
            gridview: true,
            autoencode: true,
            caption: "Student Details"
        }); 
    }); 
    </script>
    
    </head>
    <body>
        <table id="grid"></table> 
        <div id="pager"></div> 
    </body>
    
    0 讨论(0)
提交回复
热议问题