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:
https://www.experts-exchange.com/questions/28082406/Checkbox-in-a-grid-how-to-identify-on-the-client.html

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.

Andy
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
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

ASKER

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

Andy
<|:-)
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

Andy
Hi

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.

Andy
Just excellent. Thank you.

Andy
Hi

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');
                e.preventDefault();
            });
            $(window).load(function () {
                $('.CoolBit').slideDown('slow');
            });

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

Andy
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?

Andy
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.

Andy
Fantastic - worked brilliantly. Did you see my email?

Andy
Yes, I got your email.