我怀疑我的JS导致按钮无法点击。如果我注释掉jqGrid代码,按钮就会起作用。
按钮和锚点都不起作用,它们似乎已禁用,但我看不到任何影响它们。
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:
<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>
答案 0 :(得分:0)
不确定是否需要&#39; ,&#39;在{ keys: true, }
之后。你也可以把
$("#clicky").on('click', function () {
alert("This is working");
});
之前
$("#hardware-grid").jqGrid({..