How to mark and unmark the checkbox when row got selected

Talk about implementation of multirow operations

Moderators: ne_moj, zewa

ifras7
Expert
Expert
Posts: 83
Joined: Mar 17th, '10, 05:18

How to mark and unmark the checkbox when row got selected

Postby ifras7 » Apr 15th, '10, 06:48

Hello,

When page include with multi operations, is it possible to check (tick) the checkbox when particular row got selected (on mouse click) and when the same row is selected again checkbox tick should be unset. Is it possible to do?

Or at least is it possible to lighting the row when mouse get click on it? At the moment, row get lighting when is selected, but when I move the mouse for the next row lighting is disappear from selected one. I would like to keep the lighting in previous selected row when selecting the next one.

Thanks..

Ifras

administrator
Site Admin
Site Admin
Posts: 5937
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to mark and unmark the checkbox when row got selected

Postby administrator » Apr 18th, '10, 07:49

Everything is possibly, but the question why do you need this? This is not standard actions...
Any way, find in datagrid where onclick='' operations is involved and try to change them on "onmouseover" and "onmouseout"

ifras7
Expert
Expert
Posts: 83
Joined: Mar 17th, '10, 05:18

Re: How to mark and unmark the checkbox when row got selected

Postby ifras7 » Apr 19th, '10, 04:10

but the question why do you need this?
Answer is quit simple, it’s one of the requirements of my customer and I think its fair requirement too.

Thanks for details and I will do my investigation way you advised.

ifras7
Expert
Expert
Posts: 83
Joined: Mar 17th, '10, 05:18

Re: How to mark and unmark the checkbox when row got selected

Postby ifras7 » Apr 23rd, '10, 06:05

Hi,

I manage to check/uncheck the checkbox when datagrid row get click. So, thought I would share my finding with forum colleagues.

1.) Add below checkRow() javascript function to your php file
<script>
function checkRow(unique_prefix,row_id) {
if (document.getElementById(unique_prefix+'checkbox_'+row_id)!=undefined) {
document.getElementById(unique_prefix+'checkbox_'+row_id).checked = ! (document.getElementById(unique_prefix+'checkbox_'+row_id).checked);
}
}
</script>

2.) In datagrid.class.php file (Version 6.0.7), search for the word onMouseClickRow, you will find three places of onMouseClickRow word exists in datagrid.class.php file. Include the checkRow('".$this->uniquePrefix."','".$id."') function before the onMouseClickRow.

eg. call the checkRow() function as specified below
protected function RowOpen($id, $rowColor = "", $height="") {
....
....
$text .= " onclick=\"checkRow('".$this->uniquePrefix."','".$id."'),onMouseClickRow(.....";
....
....
}
You might notice that $id have to change with $r for other two places

Free feel for comments and concerns....

Ifras

daviddelmonte
Master
Master
Posts: 159
Joined: Feb 23rd, '10, 15:06

Re: How to mark and unmark the checkbox when row got selected

Postby daviddelmonte » May 20th, '10, 20:38

Thanks for posting this. I appreciate it. I believe it may be useful in other situations.


Return to “Settings: multirow operations”