views:

79

answers:

0

I've come up with the following function to fill a need:

function getTabFromElementID(elementID){
  //get all of the tabs from the tabViewObject
  var tabArray = this.get('tabs');

  var foundTabObject = nil;

  tabArray.each(function(tabObject, index){
    if(tabObject.get('element').id == elementID){
      foundTabObject = tabObject
      throw $break;
    }
  });

  return foundTabObject;
}

I would like the ability to have this function available to any TabView objects we instantiate. I'm unsure how to do this as well as how to bind it to the TabView object. I'm thinking this is probably a pretty straight-forward and hopefully common thing to do, but I haven't yet figured out how to get it done.

FYI - I am using YUI 2.x and not 3.x