Select to view content in your preferred language

ROTATE infoWindow

1212
3
03-23-2012 06:27 AM
CliveSwan
Frequent Contributor
Hi,

I need to display the infoWindow portrait if less than 5 records AND landscape if more than 5 records.

Getting getinfoWinTabContainer error, details: [object error]

Code:
>>>>>>>>>>>>>>>>>>>>>>>>
map.infoWindow.setTitle("Identify Results");
                //map.infoWindow.setContent(tc.domNode);
               
                if( (theLayerName != "Underground") && (idResults.length  == 1) )
  {
   // alert("1 record");
   map.infoWindow.resize(360, 200);
                 map.infoWindow.setContent(tc.domNode);
         }
  else if ( (theLayerName != "Underground") && (idResults.length  > 1) )
                {
                   // alert("> 1 record");
     map.infoWindow.resize(900, 425);
                 map.infoWindow.orientation == 270;
                 map.infoWindow.setContent(tc.domNode);
                 // tc = tcLarge;

   
  }
0 Kudos
3 Replies
KenDoman
Frequent Contributor
Do you want to turn your infoWindow results sideways? Or do you want your infoWindow to be wider when there are more results?

There is no "orientation" parameter for map.infoWindow. But for resize, the first number is width, and the second number is height. I would try flipping the numbers with resize to get the landscape/portrait effect. Here's some of your code modified.

map.infoWindow.setTitle("Identify Results");
//map.infoWindow.setContent(tc.domNode);

if( (theLayerName != "Underground") && (idResults.length < 5) )
{
// alert("less than 5 records");
map.infoWindow.resize(200, 360); // narrower for less records
map.infoWindow.setContent(tc.domNode);
}
else if ( (theLayerName != "Underground") && (idResults.length >= 5) )
{
// alert(">= 5 records");
map.infoWindow.resize(360, 200); // wider for more records
// map.infoWindow.orientation == 270; <- use = instead of == to set variable. This was causing your error.
map.infoWindow.setContent(tc.domNode);
// tc = tcLarge;
} 

0 Kudos
CliveSwan
Frequent Contributor
Hi Raymond,

Thanks for the email. Replacing (map.infoWindow.orientation == 270;) with map.infoWindow.orientation = 270;
Got rid of the error message. However it has not changed the infoWindow orientation??

Is there anything that I am missing??
0 Kudos
KenDoman
Frequent Contributor
There's no orientation in map.infoWindow that I can find. The closest thing I can find so far is a CSS3 transform which might work (if you're supporting a newer browser like firefox, chrome, or IE9).

For the following to your css.

.rotated270
{
transform:rotate(270deg);
-ms-transform:rotate(270deg); /* IE 9 */
-moz-transform:rotate(270deg); /* Firefox */
-webkit-transform:rotate(270deg); /* Safari and Chrome */
-o-transform:rotate(270deg); /* Opera */
} 


Then, in your JavaScript, try this.

map.infoWindow.setTitle("Identify Results");
//map.infoWindow.setContent(tc.domNode);

if( (theLayerName != "Underground") && (idResults.length < 5) )
{
// alert("less than 5 records");
map.infoWindow.resize(360, 200);
dojo.query(".infowindow").removeClass("rotated270");
map.infoWindow.setContent(tc.domNode);
}
else if ( (theLayerName != "Underground") && (idResults.length >= 5) )
{
// alert(">= 5 records");
map.infoWindow.resize(900, 425); 
dojo.query(".infowindow").addClass("rotated270");
map.infoWindow.setContent(tc.domNode);
// tc = tcLarge;
}
0 Kudos