我将以下代码写入JQGrid中的Display TransactionList
<h2>Manage Transactions</h2>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#TransactionList").jqGrid({
datatype: "local",
height: 150,
colNames: ['TransactionID', 'MinVersion', 'TransactionDateTime','RequestMessage','ResponseMessage','TransactionName','TransactionDescription','Enabled'],
colModel: [
{ name: 'TransactionID', index: 'TransactionID', width: 60 },
{ name: 'MinVersion', index: 'MinVersion', width: 100 },
{ name: 'TransactionDateTime', index: 'TransactionDateTime', width: 400 },
{ name: 'RequestMessage', index: 'RequestMessage', width: 60 },
{ name: 'ResponseMessage', index: 'ResponseMessage', width: 60 },
{ name: 'TransactionName', index: 'TransactionName', width: 60 },
{ name: 'TransactionDescription', index: 'TransactionDescription', width: 60 },
{ name: 'Enabled', index: 'Enabled', width: 60 }
],
multiselect: true,
ignoreCase: true,
hidegrid: False ,
pager: '#gridpager',
rowNum: 10,
viewrecords: true,
rowList: [10, 20, 30, 400]
});
$.ajax({
url: 'API/GetTransaction',
type: 'post',
data: null,
beforeSend: function () {
},
success: function (response) {
alert(response);
$("#TransactionList").setGridParam({ data: response }).trigger("reloadGrid");
},
error: function (error) {
alert(error);
}
});
$("#TransactionList").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" });
});
在上面的代码中,我的javascript无效。但是,
<h2>Manage Transactions</h2>
在浏览器上打印。有人可以帮我吗?
答案 0 :(得分:1)
您似乎没有标识为TransactionList
的元素。首先添加:
<div id="TransactionList"></div>
然后从那里开始工作。