1
İkinci kez tıklattığımda jquery grid çalışmıyor.Jquery ızgarası, ikinci kez yüklendiğinde çalışmıyor
var firstClick = true;
yerine bu gibi görünmelidir: açık bir şekilde click
işleyicisindeki bunu söylemek beri
$(document).ready(function() {
$('#btnlinechat').click(function() {
debugger;
var firstClick = true;
if (!firstClick) {
$("#list").trigger("reloadGrid");
}
firstClick = false;
//var getdata = function() {
//debugger;
var arr = {};
var datefromt = document.getElementById('txtfrom').value;
var datetot = document.getElementById('txtto').value;
arr.StartDate = datefromt;
arr.EndDate = datetot;
$.ajax({
//mtype: 'GET',
type: "POST",
contentType: "application/json",
//data: "{}",
data: JSON.stringify(arr),
url: "buttontest.aspx/GetData",
dataType: "json",
success: function(data) {
data = data.d;
$("#list").jqGrid({
datatype: "local",
colNames: ['Monthly Topup', 'Monthly Payout', 'Balance', 'Monthly Date'],
colModel: [{
name: 'monthlytopup',
index: 'monthlytopup',
width: 10,
height: 30,
editable: false
}, {
name: 'monthlypayout',
index: 'monthlypayout',
width: 10,
height: 30,
editable: false
}, {
name: 'balance',
index: 'balance',
width: 10,
height: 30,
editable: false
}, {
name: 'monthlydate',
index: 'monthlydate',
width: 10,
formatter: 'date',
formatoptions: {
srcformat: "Y-m-d",
newformat: 'd/m/y',
datefmt: 'd/m/y'
}
}
],
data: JSON.parse(data),
rowno: 10,
loadonce: false,
rowlist: [5, 10, 20],
pager: '#pagingGrid',
viewrecords: true,
gridview: true,
sortorder: 'asc',
rownumbers: true,
//altrows: true,
reload: true,
autowidth: false,
hoverrows: true,
height: 300,
//multiselect: false,
width: 1345,
rownumbers: true,
caption: "DATA",
});
debugger;
$('#list').jqGrid('navGrid', '#pagingGrid', {
edit: false,
add: false,
del: false,
search: true,
searchtext: "Search",
viewrecords: true,
reload: true,
//cloneToTop: false,
});
},
});
//}
});
});
Bize bir plunker gösterebilir miyim/JSFiddle/Codepen? Bize bir sürü kod koyamazsınız .. En azından bize HTML'nizi gösterin. – amanuel2
Burada kullandığı cevabı aldım jQuery ('# dataGrid') kodu jqGrid ("GridUnload"); Sorun benim için çözüldü var getgriddata = function() { debugger; jQuery ('# dataGrid'). JqGrid ("GridUnload"); var arr = {}; var datefromt = document.getElementById ('txtfrom'). –