Avatar of Andy Green
Andy Green
Flag 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/Programming/Languages/.NET/ASP.NET/Q_28082406.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
ASP.NETJavaScriptjQuery

Avatar of undefined
Last Comment
Zvonko

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Zvonko

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Andy Green

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

Andy
Zvonko

<|:-)
Andy Green

ASKER
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
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Andy Green

ASKER
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
Andy Green

ASKER
Just excellent. Thank you.

Andy
Andy Green

ASKER
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
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Andy Green

ASKER
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
Zvonko

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

ASKER
If I remove this function the functionality stops working, for example if you select Primary then Secondary isn't automatically clicked.

Andy
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Zvonko

Andy Green

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

Andy
Zvonko

Yes, I got your email.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.