Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8557115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:30:09+00:00 2026-06-11T15:30:09+00:00

I’m reposting this question from an earlier post because when I originally asked it,

  • 0

I’m reposting this question from an earlier post because when I originally asked it, it was unclear. I wasn’t sure what I actually needed, and that caused the responses I was getting to be not applicable.

Original: YUI Datatable – Get ID of DOM Element after page has loaded and use it in other YUI events


My question is this:

I have a YUI Datatable. I have a rows per page drop down. I need to create an event, or event handler, or utilize one that exists, that will handle the following:

When(ever) the drop down displaying the rows per page changes, the event handler should get the id of that drop down and pass it to another function to use as an argument. My datatable has two rowsPerPageDropDown (aka rppDD) elements. I need this functional for both of them.

Preferably, it would also do this when the page loads, but for now that’s extra credit.

I know that the id of “top” rppDD element is currently “yui-pg0-0-rpp12” but my problem extends from the fact that if I add any code to this page, that id will change (to “-rpp13” or something similar). That throws off the rest of my functions. So I want to just grab the id (whatever it may be) at run time and use it that way rather than hard coding it in.

The second function will run immediately after the drop down changes. It will use the id of the drop down to get the currently selected value and assign it to a variable to be used with a third function.


Here’s what I have so far: In the earlier thread, it was suggested that I use the event rowsPerPageChange. This works only to a certain degree. Placing a simple “hello world” alert within that event handler proves that it only alerts when the page loads. Whenever I click and change the drop down to something else it no longer alerts.

Below is the function(s) and code I’m using to test this:

var getRppValue = function() {
    YAHOO.util.Event.addListener("rowsPerPageChange", getRppValue.prototype.handleOnAvailable()); 
}

var rppDD_ID = "";

getRppValue.prototype.handleOnAvailable = function() {
    alert("hello world");
    alert(this.id); //should alert "yui-pg0-0-rpp12"
    //rppValue = this.id;
}

var rppEvent = new getRppValue();

Near as I can tell this event only fires/gets handled when the page initially loads. At that time, the first alert alerts “hello world” as expected. The second alert shows “undefined”. The intention is that the second alert should alert whatever the id of the rppDD element is (“yui-pg0-0-rpp12”).

For reference, the function I plan on passing the id into is as follows. It is intended as I mentioned above to assign the current value of [the|either|both] rppDD element(s) to the variable oRPP. It then calls the endDrag() function (which utilizes oRPP):

If I were to hard code the id it would be:

function getRPP_0(){oRPP = g("yui-pg0-0-rpp12").value;endDrag();};

I want it to by dynamic:

function getRPP_0(){oRPP = g(rppDD_ID).value;endDrag();};

Any help / suggestions are appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:30:10+00:00Added an answer on June 11, 2026 at 3:30 pm

    As we saw on the chat, you had this:

    var onRPPChange0 = YAHOO.util.Event.addListener("yui-pg0-0-rpp12", "change", getRPP_0); 
    var onRPPChange1 = YAHOO.util.Event.addListener("yui-pg0-1-rpp24", "change", getRPP_1); 
    function getRPP_0(){oRPP = g("yui-pg0-0-rpp12").value;endDrag();}; 
    function getRPP_1(){oRPP = g("yui-pg0-1-rpp24").value;endDrag();};
    

    And you wanted to be able to access the element being changed in the function.

    Fortunately, event handlers provide the element on which the event is happening in the this object.

    So, this works:

    var onRPPChange0 = YAHOO.util.Event.addListener(
        "yui-pg0-0-rpp12", "change", function() {
    
        // Notice that "this" is the element on which the event was fired
        oRPP = this.value;
    
        endDrag();
    };
    

    This way, you can generalize your function easily without hardcoding the IDs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.