Forum


20:17

12/01/2010

I apologize if this question is answered in the documentation or forum, but I am unable to find an answer to this.
I have a simple grid with three columns: id, name, isActive.
isActive is using the checkbox formatter. I simply want to capture changes to the isActive checkbox. I would like to know how to handle changes to each checkbox using JavaScript, but would also be interested in how to submit the status of all the checkboxes to the server when a "Save" button is clicked.
Thanks
19:03

Moderators
30/10/2007

Hello,
If you want custom click event you should use custo formatter
http://www.trirand.com/jqgridw....._formatter
something like:
function mycustomclick (val, options)
{
var checked = cval == 'yes' ? ” checked='checked' ” : “”;
return “<input type=\\”checkbox\\” ” + checked + ” value=\\””+ cval+”\\” offval=\\”no\\” onclick=\\”myfunc()”\\ />”;
}
where myfunc wil be your click event
egards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
02:05

12/01/2010

I can't get it to call my custom function, i'm trying to make sure it is getting called so I have an alert in the function and it is simply returning 'hello':
jQuery("#listZones").jqGrid({
url: '/onemedia/creative/edit-get-zones/id/6',
datatype: 'json',
mtype: 'POST',
multiselect: false,
colModel: [{"name":"id","index":"id","width":1,"hidden":true,"key":true},{"label":"Items","name":"name","index":"name","sortable":false},{"label":"Linked","name":"link","index":"link","sortable":false,"width":60,"align":"center","formatter":"customFormat"},{"label":"CHECK TEST","name":"checkTest","index":"checkTest","sortable":false,"width":60,"align":"center","formatter":"checkbox"}],
pager: jQuery('#pager'),
rowNum: 10,
rowList: [10,20,30,40,50],
sortname: 'id',
sortorder: 'asc',
viewrecords: true,
imgpath: '/js/jqGrid/themes/steel/images',
caption: 'Applications / Zones',
width: 600,
height: 'auto',
gridComplete: function(){ },
ondblClickRow: function(rowid, iRow, iCol, e){ },
onSelectRow: function(rowid, status){ },
treeGrid: true,
treeGridModel: 'adjacency',
ExpandColumn: 'name',
cellEdit: false,
cellsubmit: 'remote',
cellurl: ''
});
});
function customFormat(cval, options, rowObject) {
alert('here');
var checked = (cval == 'yes')?" checked='checked'":"";
return "hello";
}
Most Users Ever Online: 715
Currently Online:
67 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