RE: (ot) jQuery question

2010-12-12 Thread Rick Faircloth

Thanks, Charlie!  That gives me the correct output.
Now I can move on to the AJAX, JSON, and CF CFC processing
of data.

Would you be so kind as to actually explain what function
the i and o play in function(i,o) ?  They're variables/values
passed into the function, right?

I tested their necessity by taking them out of your
code and just using function() instead of function(i,o)
and the code still ran the same.  And even some of the
example code I found performing this kind of functionality for lists
used both i and o in the (), but only referenced the o
in the actual function.

I've always been confused about the role these variables
playing in function(i,o) and whatever was in the ().
Does the first argument (in this case, i) always mean something
specific because it's in the first argument position?  And the
same with the variable that's in the second position?

I scoured the Internet trying to get a good explanation of using
these arguments, but haven't found what I needed to understand.

Thanks for any insight you'd share!

Rick


-Original Message-
From: Charlie Griefer [mailto:charlie.grie...@gmail.com] 
Sent: Saturday, December 11, 2010 10:51 PM
To: cf-talk
Subject: Re: (ot) jQuery question


You're missing a # in your selector for #myTable.
Even with the #, couldn't get your code to run... but the following
seems to work:

$( document ).ready( function() {
var staffOrder = ;

$( '#myTable tr' ).each( function( i,o ) {
if ( staffOrder.length ) {
staffOrder += , + $( this ).attr( 'class' );
} else {
staffOrder = $( this ).attr( 'class' );
}
});

alert('staffOrder = ' + staffOrder);
});

On Sat, Dec 11, 2010 at 8:36 PM, Rick Faircloth
r...@whitestonemedia.com wrote:

 Hope some of you jQuery and CF users can answer what
 seems to me should be an easy question, but I can't
 figure out how to write this jQuery to product a list
 of values.  (I'll use AJAX and JSON to send the value list
 to a cffunction for processing).

 Given this HTML:

        table id=myTable

                tr class=1
                        td1/td
                /tr

                tr class=2
                        td2/td
                /tr

                tr class=3
                        td3/td
                /tr

                tr class=4
                        td4/td
                /tr

                tr class=5
                        td5/td
                /tr

        /table

 How can I modify this jQuery to produce
 a list of the classes of the tr's above?

 (Output I'm looking for is 1,2,3,4,5 .)

 I get staffOrder =  in the alert.  It's as if
 the each function below isn't working at all.

 Suggestions?

 Thanks!

 Rick


        $(document).ready(function() {

                var staffOrder = '';

                $('myTable tr').each(function(i,o) {

                        if      (       staffOrder.length
 )
                                {       staffOrder += ',' + o.class;
 }
                        else    {       staffOrder = o.class
 }

                });

                alert('staffOrder = ' + staffOrder);

        });





 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340018
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: (ot) jQuery question

2010-12-12 Thread Raj Vijay

Hi Rick,
 Take a look at the following jQuery Doc link http://api.jquery.com/each/
The order of the parameters matter. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340019
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: (ot) jQuery question

2010-12-12 Thread Charlie Griefer

You don't need the i or o arguments for the code I posted.  They were
remnants from copying your original code.

From the docs (http://api.jquery.com/each/):

.each( function(index, Element) )

so the first argument is the index.  .each() is looping over an array
(the array of selected DOM elements), so for each iteration, 'i' (or
whatever argument you declare) would be the position in the array of
the current element.

The second argument is the element itself, which can optionally be
passed in.  Not sure why I couldn't get it to work using o rather
than creating a new instance of $( this ) for each iteration... I'd
imagine passing the element in would be more performant, but probably
not enough of a difference to be noticeable.

On Sun, Dec 12, 2010 at 10:32 AM, Rick Faircloth
ric...@whitestonemedia.com wrote:

 Thanks, Charlie!  That gives me the correct output.
 Now I can move on to the AJAX, JSON, and CF CFC processing
 of data.

 Would you be so kind as to actually explain what function
 the i and o play in function(i,o) ?  They're variables/values
 passed into the function, right?

 I tested their necessity by taking them out of your
 code and just using function() instead of function(i,o)
 and the code still ran the same.  And even some of the
 example code I found performing this kind of functionality for lists
 used both i and o in the (), but only referenced the o
 in the actual function.

 I've always been confused about the role these variables
 playing in function(i,o) and whatever was in the ().
 Does the first argument (in this case, i) always mean something
 specific because it's in the first argument position?  And the
 same with the variable that's in the second position?

 I scoured the Internet trying to get a good explanation of using
 these arguments, but haven't found what I needed to understand.

 Thanks for any insight you'd share!

 Rick


 -Original Message-
 From: Charlie Griefer [mailto:charlie.grie...@gmail.com]
 Sent: Saturday, December 11, 2010 10:51 PM
 To: cf-talk
 Subject: Re: (ot) jQuery question


 You're missing a # in your selector for #myTable.
 Even with the #, couldn't get your code to run... but the following
 seems to work:

 $( document ).ready( function() {
        var staffOrder = ;

        $( '#myTable tr' ).each( function( i,o ) {
                if ( staffOrder.length ) {
                        staffOrder += , + $( this ).attr( 'class' );
                } else {
                        staffOrder = $( this ).attr( 'class' );
                }
        });

        alert('staffOrder = ' + staffOrder);
 });

 On Sat, Dec 11, 2010 at 8:36 PM, Rick Faircloth
 r...@whitestonemedia.com wrote:

 Hope some of you jQuery and CF users can answer what
 seems to me should be an easy question, but I can't
 figure out how to write this jQuery to product a list
 of values.  (I'll use AJAX and JSON to send the value list
 to a cffunction for processing).

 Given this HTML:

        table id=myTable

                tr class=1
                        td1/td
                /tr

                tr class=2
                        td2/td
                /tr

                tr class=3
                        td3/td
                /tr

                tr class=4
                        td4/td
                /tr

                tr class=5
                        td5/td
                /tr

        /table

 How can I modify this jQuery to produce
 a list of the classes of the tr's above?

 (Output I'm looking for is 1,2,3,4,5 .)

 I get staffOrder =  in the alert.  It's as if
 the each function below isn't working at all.

 Suggestions?

 Thanks!

 Rick


        $(document).ready(function() {

                var staffOrder = '';

                $('myTable tr').each(function(i,o) {

                        if      (       staffOrder.length
 )
                                {       staffOrder += ',' + o.class;
 }
                        else    {       staffOrder = o.class
 }

                });

                alert('staffOrder = ' + staffOrder);

        });









 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340020
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: (ot) jQuery question

2010-12-12 Thread Matt Quackenbush

In Charlie's example, 'i' is the current index position of the each loop,
while 'o' is the current item (or object) of the index.  And yes, they are
arguments passed into the function.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340021
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: (ot) jQuery question

2010-12-12 Thread Rick Faircloth

Thanks for the link, Raj.

After I work through those examples, it looks
like the use of those variable should be clear.
(Or at least clearer!) :o)

Rick

-Original Message-
From: Raj Vijay [mailto:vraajku...@rediffmail.com] 
Sent: Sunday, December 12, 2010 12:36 PM
To: cf-talk
Subject: Re: (ot) jQuery question


Hi Rick,
 Take a look at the following jQuery Doc link http://api.jquery.com/each/
The order of the parameters matter. 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340022
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: (ot) jQuery question

2010-12-12 Thread Rick Faircloth

Thanks, Charlie.

I couldn't see why the other code wouldn't work
properly either.

But I'm glad to be making some progress! :o)

Rick

-Original Message-
From: Charlie Griefer [mailto:charlie.grie...@gmail.com] 
Sent: Sunday, December 12, 2010 12:45 PM
To: cf-talk
Subject: Re: (ot) jQuery question


You don't need the i or o arguments for the code I posted.  They were
remnants from copying your original code.

From the docs (http://api.jquery.com/each/):

.each( function(index, Element) )

so the first argument is the index.  .each() is looping over an array
(the array of selected DOM elements), so for each iteration, 'i' (or
whatever argument you declare) would be the position in the array of
the current element.

The second argument is the element itself, which can optionally be
passed in.  Not sure why I couldn't get it to work using o rather
than creating a new instance of $( this ) for each iteration... I'd
imagine passing the element in would be more performant, but probably
not enough of a difference to be noticeable.

On Sun, Dec 12, 2010 at 10:32 AM, Rick Faircloth
ric...@whitestonemedia.com wrote:

 Thanks, Charlie!  That gives me the correct output.
 Now I can move on to the AJAX, JSON, and CF CFC processing
 of data.

 Would you be so kind as to actually explain what function
 the i and o play in function(i,o) ?  They're variables/values
 passed into the function, right?

 I tested their necessity by taking them out of your
 code and just using function() instead of function(i,o)
 and the code still ran the same.  And even some of the
 example code I found performing this kind of functionality for lists
 used both i and o in the (), but only referenced the o
 in the actual function.

 I've always been confused about the role these variables
 playing in function(i,o) and whatever was in the ().
 Does the first argument (in this case, i) always mean something
 specific because it's in the first argument position?  And the
 same with the variable that's in the second position?

 I scoured the Internet trying to get a good explanation of using
 these arguments, but haven't found what I needed to understand.

 Thanks for any insight you'd share!

 Rick


 -Original Message-
 From: Charlie Griefer [mailto:charlie.grie...@gmail.com]
 Sent: Saturday, December 11, 2010 10:51 PM
 To: cf-talk
 Subject: Re: (ot) jQuery question


 You're missing a # in your selector for #myTable.
 Even with the #, couldn't get your code to run... but the following
 seems to work:

 $( document ).ready( function() {
        var staffOrder = ;

        $( '#myTable tr' ).each( function( i,o ) {
                if ( staffOrder.length ) {
                        staffOrder += , + $( this ).attr( 'class' );
                } else {
                        staffOrder = $( this ).attr( 'class' );
                }
        });

        alert('staffOrder = ' + staffOrder);
 });

 On Sat, Dec 11, 2010 at 8:36 PM, Rick Faircloth
 r...@whitestonemedia.com wrote:

 Hope some of you jQuery and CF users can answer what
 seems to me should be an easy question, but I can't
 figure out how to write this jQuery to product a list
 of values.  (I'll use AJAX and JSON to send the value list
 to a cffunction for processing).

 Given this HTML:

        table id=myTable

                tr class=1
                        td1/td
                /tr

                tr class=2
                        td2/td
                /tr

                tr class=3
                        td3/td
                /tr

                tr class=4
                        td4/td
                /tr

                tr class=5
                        td5/td
                /tr

        /table

 How can I modify this jQuery to produce
 a list of the classes of the tr's above?

 (Output I'm looking for is 1,2,3,4,5 .)

 I get staffOrder =  in the alert.  It's as if
 the each function below isn't working at all.

 Suggestions?

 Thanks!

 Rick


        $(document).ready(function() {

                var staffOrder = '';

                $('myTable tr').each(function(i,o) {

                        if      (       staffOrder.length
 )
                                {       staffOrder += ',' + o.class;
 }
                        else    {       staffOrder = o.class
 }

                });

                alert('staffOrder = ' + staffOrder);

        });









 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340023
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: (ot) jQuery question

2010-12-12 Thread Rick Faircloth

Thanks, Matt! :o)

Rick

-Original Message-
From: Matt Quackenbush [mailto:quackfu...@gmail.com] 
Sent: Sunday, December 12, 2010 12:45 PM
To: cf-talk
Subject: Re: (ot) jQuery question


In Charlie's example, 'i' is the current index position of the each loop,
while 'o' is the current item (or object) of the index.  And yes, they are
arguments passed into the function.




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340024
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


(ot) jQuery question

2010-12-11 Thread Rick Faircloth

Hope some of you jQuery and CF users can answer what
seems to me should be an easy question, but I can't
figure out how to write this jQuery to product a list
of values.  (I'll use AJAX and JSON to send the value list
to a cffunction for processing).

Given this HTML:

table id=myTable

tr class=1  
td1/td
/tr

tr class=2
td2/td
/tr

tr class=3
td3/td
/tr

tr class=4
td4/td
/tr

tr class=5
td5/td
/tr

/table

How can I modify this jQuery to produce
a list of the classes of the tr's above?

(Output I'm looking for is 1,2,3,4,5 .)

I get staffOrder =  in the alert.  It's as if
the each function below isn't working at all.

Suggestions?

Thanks!

Rick


$(document).ready(function() {

var staffOrder = '';

$('myTable tr').each(function(i,o) {

if  (   staffOrder.length
)
{   staffOrder += ',' + o.class;
}
else{   staffOrder = o.class
}

});

alert('staffOrder = ' + staffOrder);

});





~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340012
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: (ot) jQuery question

2010-12-11 Thread Charlie Griefer

You're missing a # in your selector for #myTable.
Even with the #, couldn't get your code to run... but the following
seems to work:

$( document ).ready( function() {
var staffOrder = ;

$( '#myTable tr' ).each( function( i,o ) {
if ( staffOrder.length ) {
staffOrder += , + $( this ).attr( 'class' );
} else {
staffOrder = $( this ).attr( 'class' );
}
});

alert('staffOrder = ' + staffOrder);
});

On Sat, Dec 11, 2010 at 8:36 PM, Rick Faircloth
r...@whitestonemedia.com wrote:

 Hope some of you jQuery and CF users can answer what
 seems to me should be an easy question, but I can't
 figure out how to write this jQuery to product a list
 of values.  (I'll use AJAX and JSON to send the value list
 to a cffunction for processing).

 Given this HTML:

        table id=myTable

                tr class=1
                        td1/td
                /tr

                tr class=2
                        td2/td
                /tr

                tr class=3
                        td3/td
                /tr

                tr class=4
                        td4/td
                /tr

                tr class=5
                        td5/td
                /tr

        /table

 How can I modify this jQuery to produce
 a list of the classes of the tr's above?

 (Output I'm looking for is 1,2,3,4,5 .)

 I get staffOrder =  in the alert.  It's as if
 the each function below isn't working at all.

 Suggestions?

 Thanks!

 Rick


        $(document).ready(function() {

                var staffOrder = '';

                $('myTable tr').each(function(i,o) {

                        if      (       staffOrder.length
 )
                                {       staffOrder += ',' + o.class;
 }
                        else    {       staffOrder = o.class
 }

                });

                alert('staffOrder = ' + staffOrder);

        });





 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340013
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm