Note that there are some explanatory texts on larger screens.

plurals
  1. POWhere should I store my window dimensions in javascript?
    text
    copied!<p>I am popping up various Telerik RadWindows of different sizes based on the types of items that are selected. Each type of item has its own kind of edit form that pops up when clicked, so I need to set different heights and widths of the window in Javascript. Right now I'm using this function which has the dimensions for each type hard-coded:</p> <pre><code> function GetEditWindowDimensions(type) { var dimensions = null; switch (type) { case 'Type1': dimensions = { length: 330, width: 400 }; break case 'Type2': dimensions = { length: 550, width: 450 }; break; case 'Type2': dimensions = { length: 260, width: 400 }; break; case 'Type3': dimensions = { length: 260, width: 400 }; break; case 'Type4': dimensions = { length: 260, width: 400 }; break; case 'Type5': dimensions = { length: 330, width: 400 }; break; default: dimensions = { length: 500, width: 500 }; } return dimensions } </code></pre> <p>And here is my function to load the RadWindow:</p> <pre><code> function OpenEditWindow(type) { var oDimensions = GetEditWindowDimensions(type) var oWindow = openWindow('myurl.aspx', oDimensions.length, oDimensions.width, true); oWindow.MoveTo(200, 25); } </code></pre> <p>There has got to be a nicer way to do this. Do you have any ideas on how I could store/retrieve these dimensions in a configurable way in Javascript? The types themselves are defined by an enum in a .vb file in the project. I pass the enum value name to GetEditWindowDimensions().</p> <p>Thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload