Taking long time to load
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2012 02:56 AM
Hi,
i used below script( code) to hide the variable in request item, but the request item form is getting long time to load because this script use (DOM Approach). it will check each and every variable in the form. So, how to optimise this code to reduce the loading time.
function onLoad(){
try{
//Get the 'Variables' section
var ve = $('variable_map').up('table');
//Disable all elements within with a class of 'cat_item_option'
ve.select('.cat_item_option', '.slushselectmtm', '.questionsetreference').each(function(elmt){
//Special handling to allow scroll/copy in textarea and fix lost date on save issue
if((elmt.tagName.toLowerCase() == 'textarea') || (elmt.tagName.toLowerCase() == 'input' && elmt.type.toLowerCase() == 'text')){
elmt.readOnly = true;
}
//Everything else gets disabled
else{
elmt.disabled = true;
}
});
//Remove any reference or calendar icons
ve.select('img[src*=reference_list.gifx]', 'img[src*=small_calendar.gifx]').each(function(img){
img.hide();
});
//Hide list collector icons
ve.select('img[src*=arrow]').each(function(img){
img.up('table').hide();
});
}
catch(e){}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2012 06:21 AM
If your goal is to hide the variables on a variable editor, there is a better approach to this : you need to use,
g_form.setDisplay('variables.<varible_name>', false)
And if you are using DOM, it will take time because of the reason that it needs to get each and every element.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2013 05:58 AM
thanks for your guide but i need to write the script which is applicable to all the request item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2013 07:00 AM
If I understand it correctly, You want to hide all variables on the Variable editor? Then yes, You need to write the line of code that I gave you to hide each and every variable.
Correct me if I am wrong, By showing me what you would want to do.