TOC - Arrows instead of plus sign to expand TOC

4147
18
Jump to solution
06-15-2016 12:11 PM
BrianFoley1
New Contributor II

I want to replace the plus '+' sign with an arrow for the opening and closing of an item in the TOC.  Also, I want to put the arrow to the left of the checkbox.  How can I do this ?

--Brian

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Brian,

  Sure you can do that if you modify the TOC.js and the TOC.css files

In the TOC.js make this change to the templateString (to move the expand icon to the left of the checkbox):

templateString: '<div class="agsjsTOCNode">' +
    '<div data-dojo-attach-point="rowNode" data-dojo-attach-event="onclick:_onClick">' +
    '<span data-dojo-attach-point="contentNode" class="agsjsTOCContent">' +
    '<img src="${_blankGif}" alt="" data-dojo-attach-point="iconNode" />' +
    '<span data-dojo-attach-point="checkContainerNode"></span>' +
    '<span data-dojo-attach-point="labelNode">' +
    '</span></span></div>' +
    '<div data-dojo-attach-point="containerNode" style="display: none;"> </div></div>',

and add this css rule to the TOC.css:

.claro .dijitTreeExpando {
    background-image: url("images/treeExpandImages.png") !important;
    width: 16px;
    height: 16px;
    background-position: -35px 0;
}

and Add an images folder to the agsjs\dijit\css folder and then save this image into it:

treeExpandImages.png

View solution in original post

18 Replies
RickeyFight
MVP Regular Contributor

Brian what TOC are you referring too? Can you post a link to some script?

0 Kudos
BrianFoley1
New Contributor II

Rickey, I am using nliu's TOC widget.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brian,

  Sure you can do that if you modify the TOC.js and the TOC.css files

In the TOC.js make this change to the templateString (to move the expand icon to the left of the checkbox):

templateString: '<div class="agsjsTOCNode">' +
    '<div data-dojo-attach-point="rowNode" data-dojo-attach-event="onclick:_onClick">' +
    '<span data-dojo-attach-point="contentNode" class="agsjsTOCContent">' +
    '<img src="${_blankGif}" alt="" data-dojo-attach-point="iconNode" />' +
    '<span data-dojo-attach-point="checkContainerNode"></span>' +
    '<span data-dojo-attach-point="labelNode">' +
    '</span></span></div>' +
    '<div data-dojo-attach-point="containerNode" style="display: none;"> </div></div>',

and add this css rule to the TOC.css:

.claro .dijitTreeExpando {
    background-image: url("images/treeExpandImages.png") !important;
    width: 16px;
    height: 16px;
    background-position: -35px 0;
}

and Add an images folder to the agsjs\dijit\css folder and then save this image into it:

treeExpandImages.png

BrianFoley1
New Contributor II

Thanks Robert, I'm almost there.  I did exactly what you said, but am still getting the '+' and '-' images to toggle the laters.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brian,

I have tested this on my end so I know it works. Did you add an images folder to the agsjs\dijit\css folder?

0 Kudos
BrianFoley1
New Contributor II

I got it to work with the image for the arrows to show.  When I expand a layer, is the arrow supposed to change to the right pointing arrow ?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brain,

    it is right for expand and down for collapse

Untitled-1.jpg

0 Kudos
BrianFoley1
New Contributor II

I'm just getting the down arrows whether the layer is expanded or collapsed.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brian,

  Are you referencing the TOC.css in your app?

<link rel="stylesheet" href="agsjs/dijit/css/toc.css">

0 Kudos