Tôi có mã jQuery sau đây mà tôi đang sử dụng để điền một jqGrid. Nó hoạt động hoàn toàn gửi bài đến trang ASP.NET MVC của tôi trên nhấp chuột đầu tiên của nút. Vấn đề của tôi
là, bất kỳ nhấp chuột nào khác qua lần đầu tiên có vẻ như chạy qua mã jquery khi nhấp vào nút nhưng nó không bao giờ chuyển sang trang POST. Bất kỳ ý tưởng tại sao?Nhấp vào nút jQuery làm mới của jqGrid chỉ kích hoạt một lần
<script type="text/javascript">
$(document).ready(function() {
$('#btnSubmit').click(function() {
/* Refreshes the grid */
$("#list").jqGrid({
/* The controller action to get the grid data from */
url: '/CRA/AddPart',
data: { partNumber: "123"},
datatype: 'json',
mtype: 'GET',
/* Define the headers on the grid */
colNames: ['col1', 'col2', 'col3', 'col4'],
/* Define what fields the row columns come from */
colModel: [
{ name: 'col1', index: 'invid', width: 290 },
{ name: 'col2', index: 'invdate', width: 290 },
{ name: 'col3', index: 'amount', width: 290, align: 'right' },
{ name: 'col4', index: 'tax', width: 290, align: 'right'}],
height: 'auto',
rowNum: 10,
rowList: [10, 20, 30],
sortname: 'id',
sortorder: "desc",
viewrecords: true,
imgpath: '../../Scripts/jgrid/themes/steel/images',
caption: 'Core Return Authorization Contents:',
cellEdit: true
});
});
});
</script>
đó đã làm việc một cách hoàn hảo, cảm ơn bạn! –