Expand d'une vue Notes sous le web

Publié:
09 Sep 2003 à 15:30
par Raziel
salut,Une question (ou plutôt deux) m'amene à m'adresser à vous.Problématique 1 :J'ai une vue notes dont la colonne1 et la colonne 2 sont catégorié. Je voudrais, lors de l'ouverture de la vue, etendre uniquement la colonne 1 et laissé la 2 condenser. Connaissez vous un moyen ?Problématique 2 :Je voudrais changer l'image du triangle bleu uniquement pour cette vue et non pour l'ensemble des vues notes (dans ce cas j'aurais directement modifié l'images contenu dans le dossier icone).Je souhaiterai aussi changer cette image en fonction que la section est condensé ou détailléUne idée ?D'avance merciRaziel
Re: Expand d'une vue Notes sous le web

Publié:
10 Sep 2003 à 10:16
par Sylvain
Pour ta premiere question, lorsque tu ouvres ta vue, ajoute "&Expand=1#1" en paramètre dans ton url, ça devrait l'faire.Exemple :
http://serveur/base/vue?openVue&Expand=1#1Sinon pour ta deuxieme question, notes ne l'a pas prévu mais j'pense qu'il ya moyen de s'en sortir en déclenchant une petite fonction javaScript à l'ouverture de la page.La petite fonction en question scanne toutes les images, detecte si c'est un triangle (si SRC = /icons/collapse.gif ) et remplace le parametre SRC de la balise IMG par ton image qui va bien. J'ai jamais essayé mais j'pense que ça peut fonctionner.[%sig%]
Re: Expand d'une vue Notes sous le web

Publié:
10 Sep 2003 à 10:38
par Raziel
Salut,merci pour ta réponse.J'ai rajouté le "&Expand=1#1" mais le pb s'il qu'il ne m'étend que la première section de la première colonne. Ce que je souhaiterai, c'est qu'il m'étende toutes les sections de la première colonne.
Re: Expand d'une vue Notes sous le web

Publié:
10 Sep 2003 à 11:26
par Stephane Maillard
Bonjour,J'ai trouvé ceci pour la question 2 :When using a $$ViewBody field (to display a categorized view) on your $$ Templates (either $$ViewTemplate or $$NavigatorTemplate) you are "stuck" with the default icons when a individual row is collapsed () or expanded (). Or, are you really "stuck"? Here is some code that you can use to change those icons to be whatever you want. You can change them to be other icons included with Notes or you can change them to be attachments to a document if you want.Include the following code after your $$ViewBody field. The code should be written using pass-through HTML. Here's the code:<script language="JavaScript"><!--function replaceImage(original, substitute) { if (document.images) { // make sure the browser supports on-line image changing for (var i=0; i < document.images.length; i++) { var imageString = document.images[i].src.toString(); if (imageString.indexOf(original) != -1) { document.images[i].src = substitute } } // Move on to the next image } // Ends the check to make sure image swapping is supported} // Ends the "replaceImage" functionreplaceImage("/icons/collapse.gif", "[ImageToShowWhenExpanded]");replaceImage("/icons/expand.gif", "[ImageToShowWhenCollapsed]");// --></script>[ImageToShowWhenCollapsed] is either a notes field or a hard-coded path to the new image to be displayed when the line is expanded. Similarly, [ImageToShowWhenExpanded] is the path to the new image to be displayed when the line is collapsed. Make sure that if you use Notes fields that the fields are text and computed for display.Note that this only works on browsers that support on-line image changing (version 3 or 4 of Netscape, or version 4 of IE). But the code will not fail on older browsers -- it will just simply leave the default expand and collapse icons alone.Alternate MethodIf you don't like the above way of changing the icons, then in your $$HTMLHead field, or in the JSHeader section, include the following script:<SCRIPT language=JavaScript>function changeTwisties() { var i, nullcount, expand, collapse; expand = new Image(); // creates new image object instance and assigns reference expand.src = "/icons/grayexp.gif"; // place URL to your image for expand collapse = new Image(); collapse.src = "/icons/graycol.gif"; // place URL to your image for collapse nullcount = 1; // initialize nullcount to non-zero so it enters the while loop. while (nullcount) { // while loop tests if all the images are loaded by the browser nullcount = 0; // Reset nullcount which counts number of images remaining to download. // document.images is collection of all images (<IMG> tags) on the document // it has length attribute representing the image count. for (i = 0; i < document.images.length; i++) { if (document.images[i].src == null) { // src is property that stores the image url nullcount++; } else { // If the image has been loaded into the browser if (document.images[i].src.indexOf('expand.gif')>0) { // checks expand document.images[i].src = expand.src; // Change the image's source to be the image you want } else if (document.images[i].src.indexOf('collapse.gif')>0) { //checks collapse document.images[i].src = collapse.src; // Change the image's source to be the image you want } // Ends the check to see if it's one of the images we want to change } // Ends the check to see if the image's source is null } // Move on to the next image } // Ends the "while" loop} // Ends the "replaceTwisties" function</SCRIPT>This code will loop through the images on the page and replace the image source on the page. This function needs to be called after the page is loaded by putting the following into the view template's HTML Body Attributes field:"onLoad=\"replaceTwisties()\""Each code works equally well and only works on browsers that support image changing on the fly (but won't error on other browsers).[%sig%]