jqwidget jqxgrid显示一列中的所有数据并且无组织

时间:2017-10-10 15:06:49

标签: javascript jquery html jqxgrid jqwidget

在从asp.net mvc发布我的项目之前,我发布它之后一切正常工作jqwidget jqxgrid显示这样的数据 enter image description here

一切都搞砸了。 我的布局页面



    <link src="~/Scripts/jqwidgets/styles/jqx.base.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-3.2.1.min.js"></script>
    <script src="~/Scripts/jqwidgets/jqx-all.js"></script>
    <script src="~/Scripts/jqwidgets/jqxcore.js"></script>
    <script src="~/Scripts/jqwidgets/jqxdata.js"></script>
    <script src="~/Scripts/jqwidgets/jqxbuttons.js"></script>
    <script src="~/Scripts/jqwidgets/jqxscrollbar.js"></script>
    <script src="~/Scripts/jqwidgets/jqxmenu.js"></script>
    <script src="~/Scripts/jqwidgets/jqxgrid.js"></script>
    <script src="~/Scripts/jqwidgets/jqxgrid.pager.js"></script>
    <script src="~/Scripts/jqwidgets/jqxgrid.selection.js"></script>
    <script src="~/Scripts/jqwidgets/jqxdropdownlist.js"></script>
    <script src="~/Scripts/jqwidgets/jqxlistbox.js"></script>
    <script src="~/Scripts/jqwidgets/jqxgrid.columnsresize.js"></script>
    <script src="~/Scripts/jqwidgets/jqxcalendar.js"></script>
    <script src="~/Scripts/jqwidgets/jqxdatetimeinput.js"></script>
    <script src="~/Scripts/jqwidgets/jqxgrid.edit.js"></script>
    <script src="~/Scripts/jqwidgets/jqxcheckbox.js"></script>
    <script src="~/Scripts/jqwidgets/jqxgrid.filter.js"></script>
    <script src="~/Scripts/jqwidgets/jqxgrid.sort.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>



    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
&#13;
<style>
        /* Set height of the grid so .sidenav can be 100% (adjust if needed) */
        .row.content {
            height: 500px;
        }

        /* Set gray background color and 100% height */
        .sidenav {
            background-color:rgb(5, 41, 99);
            font-style: italic;
            height: 100%;
            }

        .sidenav a {
            color: white;
            font-size: large;
        }
        .float {
            display: inline-block;
            float: left;
        }
                
    </style>
&#13;
<body>
    <img src="~/Images/Logo.jpg" width="250" height="100" />
    <div class="container-fluid">
        <div class="row content">
            <div class="col-xs-2 sidenav">
                <div  style="background-color: rgb(2,31,78); ">
                    <br />
                    <br />
                    @if (User.IsInRole("admin") || User.IsInRole("Admin"))
                    {
                        <a href="~/Default/purchaseview">
                            <span class="glyphicon glyphicon-shopping-cart">  Purchased</span>
                        </a><br />
                        <a href="~/Account/Register">
                            <span class="glyphicon glyphicon-log-in">  Register</span>
                        </a><br />
                    }
                    <a href="~/Default/customerview">
                        <span class="glyphicon glyphicon-user">  Customers</span>
                    </a><br />
                    <a href="~/Default/sellview">
                        <span class="glyphicon glyphicon-shopping-cart">  Sell</span>
                    </a><br />
                </div>
            </div>

            <div class="navbar navbar-inverse navbar-fixed-top">
                    <div class="container">
                        <div class="navbar-header">
                            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                            @Html.ActionLink("Application name", "Index", "Home", null, new { @class = "navbar-brand" })
                        </div>
                        <div class="navbar-collapse collapse">
                            <ul class="nav navbar-nav">
                                <li>@Html.ActionLink("Home", "Index", "Home")</li>
                                <li>@Html.ActionLink("About", "About", "Home")</li>
                                <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                            </ul>
                            @Html.Partial("_LoginPartial")
                        </div>
                    </div>
                </div>
            <div class="col-sm-9">
                @RenderBody()
                <hr />
            </div>

        </div>
    </div>

    @*@Scripts.Render("~/bundles/jquery")*@
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
&#13;
&#13;
&#13;

和我的HTML页面

&#13;
&#13;
<script type="text/javascript">
    $(document).ready(function () {
        // Inquiry Table
        // prepare the data
        var source =
        {
            datatype: "json",
            datafields: [
            { name: 'CusID', type: 'string' },
            { name: 'name', type: 'string' },
            { name: 'phone', type: 'number' },
            { name: 'email', type: 'string' },
            { name: 'Balance', type: 'number' },
            ],
            url: 'getCustomer'
        };
        var dataAdapter = new $.jqx.dataAdapter(source);
        // initialize jqxGrid
        $("#lab").jqxGrid(
        {
            width: 670,
            source: dataAdapter,
            autoheight: true,
            pageable: true,
            columns: [
            { text: "CusID", datafield: "CusID", width: 100 },
            { text: "name", datafield: "name", width: 200, cellsformat: 'd' },
            { text: "phone", datafield: "phone", width: 150 },
            { text: "email", datafield: "email", width: 120 },
            { text: "Balance", datafield: "Balance", width: 100 },
            ]
        }); // End of Inquiry Table

       
    });
</script>
&#13;
<body>
    @*<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal11"></button>*@
    <a href="#" class="btn btn-info btn-lg" data-target="#myModal11" data-toggle="modal">
        <span class="glyphicon glyphicon-plus"></span> Add New
    </a>
    @*<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Update</button>*@
    <a href="#" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">
        <span class="glyphicon glyphicon-edit"></span> Update
    </a>
    <div class="container">
        <!-- Modal -->
        <div class="modal fade" id="myModal" role="dialog">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">Update payment</h4>
                    </div>
                    <div class="modal-body">

                        <div class="col-sm-8">
                            <form method="post" action="customerupdate">
                                <table>
                                    <tr>
                                        <td>
                                            <select name="CusID" id="CusID1">
                                                @foreach (var std in ViewBag.cust)
                                                {
                                                    <option value="@std.CusID">@std.name</option>
                                                }
                                            </select>
                                        </td>
                                        <td>
                                            <input type="text" name="Balance" id="Balance1" placeholder="Paid" />
                                        </td>
                                        <td>
                                            <input type="submit" value="Submit" id="submit1" />
                                        </td>
                                    </tr>
                                </table>
                            </form>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="container">
        <!-- Modal -->
        <div class="modal fade" id="myModal11" role="dialog">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">Add New Customer</h4>
                    </div>
                    <div class="modal-body">
                        <form action="customercreate" method="post">
                            <input type="text" id="CusID" name="CusID" placeholder="CusID" hidden />
                            <input type="text" id="name" name="name" placeholder="Name" />
                            <input type="text" id="phone" name="phone" placeholder="Phone" />
                            <input type="text" id="email" name="email" placeholder="Email" />
                            <input type="text" id="Balance" name="Balance" placeholder="Balance" />
                            <input id="Submit1" type="submit" value="submit" />
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="lab"></div>
               
</body>
&#13;
&#13;
&#13;

我所有的图书馆工作都很好,数据库也在工作。我只有Jqxgrid有问题我不知道该怎么办请帮忙。

2 个答案:

答案 0 :(得分:0)

CSS文件未正确引用或在代码中指向的位置不可用。

答案 1 :(得分:0)

发布时出现问题。我通过重新发布解决了它,现在一切正常。