Hi,
I'm mostly looking for ideas, here.
I have a main control with tabs and several child controls. I have done this A: to simplify the main control and B: because I will need to turn some features on / off and so not render some of these child controls.
It now turns out that I will be populating these controls client-side via javascript.
Currently, my main control gets the data then checks that each control exists, checks that each control's populateMe() function exists, then passes that object to that control.
To avoid confusion with the child control populateMe() function names (I didn't actually call any of my functions populateMe()), I instead create an array of functions that each control pushes it's own populateMe() function to.
IE:
var AgentPortalPopulateDetailFunctions = [];
function populateChildren(data){
$.each(AgentPortalPopulateDetailFunctions,function(){
this(data);
});
}
$(function () {
AgentPortalPopulateDetailFunctions.push(function(data){
});
});
This means that my main control has no idea what info the control needs so it passes the whole object each time. It's not a massive object but it's not small and this process will happen almost as fast as the user can click :S
Q1: Is passing this large object from one function to another problematic?
Q2: Is there another way I can do this that still keeps each child-control separate?
Any ideas would be useful :)
Thanks ^_^
Andy