Page 1 of 1

MydfProHTML - hack to autocollapse previous info row

Posted: Sat Oct 23, 2010 1:17 pm
by lajcik
Hi,

I was going to post a feature request but when I saw how easy it is to modify export templates i just gone and did what i wanted :)

I was really annoyed that when you open one box the other doesn't collapse by default which can quickly get messy. Here's a quick modification to automatically collapse the previous details.

Since the forum has attachments disabled I'll just post the code:

Replace the images/js.js in the template :)

Code: Select all

/* Hidden */
var opened = undefined;

function view(x) {
  var targetId, targetElement;
  targetId = x;

  if (document.getElementById){
	     targetElement = document.getElementById(targetId);
  }else if(document.all){
  	 targetElement = document.all[targetId];
  }else if(document.layers){
  	targetElement = document[targetId];
  }

   if (targetElement.style.display == "none") {
		if(opened != undefined) {
			opened.style.display = "none";
		}
        targetElement.style.display = "block";
		opened = targetElement;
	} else {
        targetElement.style.display = "none";
		opened = undefined;
    }
}

Re: MydfProHTML - hack to autocollapse previous info row

Posted: Sat Oct 23, 2010 10:26 pm
by Conor
Thank you for sharing your improvement, I am positive others will find it useful. I can see a use for both behaviors so I will leave the shipping template as is.