简体   繁体   English

添加jqGrid后,按钮停止工作

[英]Buttons stopped working after adding jqGrid

I suspect something my JS is causing the buttons to not be clickable. 我怀疑我的JS导致按钮不可点击。 If I comment out the jqGrid code, the buttons will work. 如果我注释掉jqGrid代码,则按钮将起作用。

The button and anchor are both not working, they seem disabled, though I don't see anything making them so. 按钮和锚点均不起作用,它们似乎已禁用,尽管我看不到有什么作用。

js: JS:

$(document).ready(function () {

    $("#hardware-grid").jqGrid({

        url: '/Hardware/PopulateHardwareGrid',
        datatype: "json",
        colNames: ['Id', 'Type', 'Model', 'Description', 'Price', 'Select'],
        colModel: [
                { name: "Id", key: true, hidden: true },
                { name: "ItemType" },
                { name: "Model" },
                { name: "ItemDescription", width: 400 },
                { name: "Price", formatter: "currency", align: "center" },
                { name: "Select", formatter: 'actions', formatOptions: { keys: true, } }
        ],
        loadonce: false,
        height: 'auto',
        pager: '#grid-pager'

    });

    $("#clicky").on('click', function () {
        alert("This is working");
    });

});

html: HTML:

<input type="button" value="Alert Selected ID" class="btn btn-default" id="clicky" />


<div class="tile tile-blue">
    <h2>Computers</h2>
    <table class="table table-bordered table-striped" id="hardware-grid"></table>
    <div id="grid-pager"></div>

    <hr />

    <h2>Mobile Devices</h2>


   <a class="btn btn-info" href="/Accessory">Next</a>


</div>

Not sure if there is a need of ' , ' after { keys: true, } . 不知道在{ keys: true, }之后是否需要' '。 Also you can put 你也可以放

$("#clicky").on('click', function () {
        alert("This is working");
    });

before 之前

$("#hardware-grid").jqGrid({..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM