Link to home
Start Free TrialLog in
Avatar of Andy Green
Andy GreenFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Checkbox in a grid (part 2)

I asked and got an excellent respose to this question the other day here:

I have to expand this, and its doing my head in.

In each row of a grid (a Rad Grid) I have the following:

checkboxL  CheckboxR  Textbox  CheckboxPri  CheckboxSec

What I'm trying to do using the code previously provided it to do this:

1. If either the L or R check boxes are ticked then the checkboxSec is also ticked row changes colour

2. If checkboxPri is ticked the checkBoxSec is also ticked ( this was the original question) row changes colour

3. If any other CheckBoxPri is ticked then the previous checkboxPri is unticked but leaves the CheckboxSec ticked. I'm doing thsi OK with an on click event

4. if CheckbocSec is unticked all checkboxes are cleared as is any text in the text box, row colour is removed.

I appreciate this is a lot of work, but any pointers would be brilliant.

Avatar of Zvonko
Flag of North Macedonia image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Andy Green


You guys are fantastic, the second row doesn't select properly, but I can take a look at that.

Hi Zvonko

Thanks again for this its superb and I've learnt a lot from the logic of it.

One issue, when you first click the secondary the row doesn't change colour.
I have added the line setRowColor(theBox, "lightgray"); to the setSecondaryProcedure and the row changes colour when its deselecting the row (4 above)

I have debugged the code and the setSecondaryProcedure isn't being hit on the first click, only the second (this deselects).

Any ideas


Ignore that last post, I have sorted it. I missed the If !thebox, by adding an else to change the row colour it now works.

Just excellent. Thank you.


Actually there is one issue.

I have this script after the one you supplied and with your scripts this doesn't work any more. It forces a couple of buttons to the bottom of the page like a to top button, and they scroll with the page.

        //Does the cool button stuff
        $(document).ready(function () {
            //Save area
            $('a.CoolBit').click(function (e) {
                $('html, body').animate({ scrollTop: 0 }, 'slow');
            $(window).load(function () {

I get the error Unable to get document ready of undefined or null reference  at this line -  $(document).ready(function () {

I've done a bit more investigating as some validation scripts stopped working, and its this that's causing the trouble

        function $(theId) {
            return document.getElementById(theId);

Any ideas?

Sorrs, you have to REMOVE my version of the upper function.
My upper version overwrites some function that your grid imports from elsewhere, you see?
If I remove this function the functionality stops working, for example if you select Primary then Secondary isn't automatically clicked.

Fantastic - worked brilliantly. Did you see my email?

Yes, I got your email.