Forum
10:27
14/01/2011
Hello,
I am having an issue that is very similar to an old bug:
http://www.trirand.com/blog/?p.....-jqgrid-36
1. Click on cell with content Yes
2. Change the value from checked to unchecked
3. Press Enter to save it
evarthing correct.
But this not work (bug)
1. Click on cell with content Yes
2. Change the value from checked to unchecked
3. "CLICK ANOTHER CELL"
The difference is that I am using a checkbox formatter for display, not just for edit like this
The same happens:
1. Click on checkbox
2. Click inside the cell of the checkbox to highlight with celledit
3. Press Enter to save
Works fine
But this does not
1. Click on checkbox to change value
2. Click somewhere else
3. Do a sort or filter -> Checkbox loses the change
Here is the full code, that I posted in another thread before:
http://www.trirand.com/blog/?p.....reservedi/
09:44
14/01/2011
I think my issue is a duplicate of this:
18:20
15/07/2011
I had done this, share with you :
$.ajax({
url: 'sheet.aspx?q=load',
datatype: 'json',
success: function (data) {
$("#grid_id").jqGrid({
url: '',
datatype: 'clientSide',
mtype: 'POST',
height: 'auto',
colNames: data.colNames, //get from code behide
colModel: data.colModel, //get from code behide
viewrecords: true,
rowNum: 15,
headtitles: true,
data: data.rows,
jsonReader: {
root: "rows"
},
hidegrid: false,
cellurl: 'sheet.aspx?q=update',
beforeSubmitCell: function (rowid, celname, value, iRow, iCol) {
return { celname: celname }
},
loadError: function (xhr, status, error) { alert(status + " " + error); }
});
jQuery(".jqgrow td input").each(function () { //detect all input
jQuery(this).click(function () {
jQuery(this).change(function () {
var data = new Array(3);
data[0] = "{id:\"" + $(this).parents('tr').attr('id').replace(/^\s*|\s*$/g, "") + "\","; // replace = trim
var colname = $(this).parents('td').attr('aria-describedby').replace("grid_id_", ""); // get colname
var value = ($(this).prop('checked')) ? "True" : "False";
data[1] = colname + ":\"" + value + "\",";
data[2] = "celname:\"" + colname + "\"}"
$.ajax({
url: 'sheet.aspx?q=update',
type: 'POST',
data: eval('(' + data[0] + data[1] + data[2] + ')'), //eval is string to json
beforeSend: function (jqXHR, textStatus) { jQuery('#grid_id').block({ message: '<h1>Loading...</h1>' }); },
complete: function (jqXHR, textStatus) { jQuery('#grid_id').unblock(); },
loadError: function (xhr, status, error) { alert(status + " " + error); }
});
});
});
});
},
error: function (x, e) {
alert(x.readyState + " " + x.status + " " + e.msg);
}
});
});
these code can ajax save the checkbox state.
Most Users Ever Online: 715
Currently Online:
39 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66