Forum
10:53
26/07/2013
Hi,
I have a column with a checkbox and want to react on a click inside the edit form (where the checkbox is visible and clickable). The reason is, that I want to set some textboxes inside the edit form depending on the checkbox's value (0:1). I found Oleg's code:
var iCol = getColumnIndexByName ($(this), 'ebl'), rows = this.rows, i,
c = rows.length;
for (i = 1; i < c; i += 1) {
$(('input[type="checkbox"]'),rows[i].cells[iCol]).click(function (e) {
var id = $(e.target).closest('tr')[0].id,
isChecked = $(e.target).is(':checked');
alert('clicked on the checkbox in the row with id=' + id +
'\nNow the checkbox is ' +
(isChecked? 'checked': 'not checked'));
});
}
That does work inside the grid, but not in the edit form. How would I need to change the function? And would it have to be called in beforeShowForm of the edit form?
Thanks,
dikrid
13:04
26/07/2013
I solved it this way (after analysing the html code):
var tabform = document.getElementById('TblGrid_grid');
var iCol = 1, rows = tabform.rows, i,
c = rows.length;
for (i = 1; i < c; i += 1) {
$(('input[type="checkbox"]'),rows[i].cells[iCol]).click(function (e) {
var id = $(e.target).closest('tr')[0].id,
isChecked = $(e.target).is(':checked');
alert('clicked on the checkbox in the row with id=' + id +
'\nNow the checkbox is ' +
(isChecked? 'checked': 'not checked'));
});
}
It can surely be optimized by finding iCol, et cetera, but I can work with this.
Thanks anyway,
dikrid
18:26
Moderators
30/10/2007
Hello,
Thank you for sharing your solution. Every solution is ok if it do the job.
Regards
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.
Most Users Ever Online: 715
Currently Online:
31 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