Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Formatter Checkbox handle change event
12/01/2010
20:17
Avatar
njcalugar
USA
Member
Members
Forum Posts: 4
Member Since:
12/01/2010
sp_UserOfflineSmall Offline

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

13/01/2010
01:01
Avatar
njcalugar
USA
Member
Members
Forum Posts: 4
Member Since:
12/01/2010
sp_UserOfflineSmall Offline

I figured how to get the values when a "Save" button is clicked by using the getCol method.

Anyone know how to add a click event to the inputs created by the checkbox formatter?

13/01/2010
19:03
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

15/01/2010
02:05
Avatar
njcalugar
USA
Member
Members
Forum Posts: 4
Member Since:
12/01/2010
sp_UserOfflineSmall Offline

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':

$(document).ready(function() {

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";
}

15/01/2010
02:23
Avatar
njcalugar
USA
Member
Members
Forum Posts: 4
Member Since:
12/01/2010
sp_UserOfflineSmall Offline

I think I'm doing the colModel incorrectly - I am using PHP code to generate the grid configuration and json_encoding a PHP array isn't correct because all the keys and string values are enclosed in quotes.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
27 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information