Gregory's Blog

ColdFusion arrays can't use zero as an index.

I should have known better, but you can't use a zero as an index when constructing a ColdFusion array. On this blog, I have 14 different themes, and 39 settings for each theme, so I had thought to create an array to store the values in. I wanted to use a zero as an index to identify the name of the theme, and then use 1 through 39 as the theme setting. However, when I tried this approach I received the following error: "A scalar value of type java.lang.String cannot be assigned to a 2-dimensional ColdFusion array." I find this odd however, as typically, most other languages default to a zero on the first array item, and I assumed that I could use a zero here.

Here was my original code that caused this error:

view plain about
1<!--- Theme --->
2<cfset application.arrThemeSettingsFromIniStore[1][0] = "black"><!--- black --->
3<!--- Theme variables --->
4<cfset application.arrThemeSettingsFromIniStore[1][1] = trim(getSettingsByTheme('black').useCustomTheme)><!--- useCustomTheme --->
5more custom theme settings...

The code should not use a zero based index like so:

view plain about
1<!--- Theme --->
2<cfset application.arrThemeSettingsFromIniStore[1][1] = "black"><!--- black --->
3<!--- Theme variables --->
4<cfset application.arrThemeSettingsFromIniStore[1][2] = trim(getSettingsByTheme('black').useCustomTheme)><!--- useCustomTheme --->
5more custom theme settings...

This entry was posted on May 25, 2019 at 12:31 AM and has received 4 views.

There are currently 0 comments.

Theme Settings in the administrative web interface.

There are quite a few different theme settings in Gregory's blog. The themes are set using the Blog Settings page in the Blog administrative interface. I will briefly go over each new setting here. I will also create a how to document in the future to better document these features. It it safe to play around with these settings. If you make a mistake, you can always reset the default settings for the particular theme by clicking on the 'reset themes' button at the bottom of the settings administrative page.

  • Notes: this blog is highly optimized for mobile, and some of these settings will not apply. I have indicated what settings are not available to mobile devices in the notes section below.
  • The following three settings are global, and affect all themes.
    1. Parent Site Name and Link: The parent site name and parent site link form elements controls the behavior of the menu found at the top of the header. It allows the user to add an option in the menu that links to their home site.
    2. The 'Parent Site Name' will display the title of the site within the menu. On my site, the text is 'Gregory Alexander - Web Design'. The 'Parent Site Link' can be any link to another site. The link is triggered when a user clicks on the menu option. On this site, the link is
    3. 'Default Font Size' will set the font size for the blog content. You can choose any value between 8 and 26 points. Note: the 'Default Font Size' will not change the size of the text in the header. I manually set the header text to be at 16 point in the menu on desktop devices, and 12 points for mobile devices.

    All of the settings below can be set by theme. Each theme operates independently, and can have its own unique settings. You can modify up to 14 unique themes.

    1. The 'Modify Default Themes' checkbox is used when the owner of the blog is ready to modify the default themes. Until this button is checked, the site will operate as it is intended here, with the default settings intact.
    2. The 'Kendo Base Theme' allows the blog owner to review all of the default blog settings. Blog owners can look and see where the current images are stored, what library paths are used, and determine the element properties of the containers on the site. It is recommended that you browse the existing themes, and choose the theme that is closest to the theme that you want to create. In order to modify a theme, click on the default theme that you are interested in, and modify the settings that are displayed in the form.
    3. 'Kendo Theme .css Location' (string): if you want to create your own Kendo less based theme and replace the existing .less based theme, use the Kendo Theme Builder to modify the base theme, upload it, and change the default path and point it to the new .less file that you created using the Kendo theme builder.
    4. 'Kendo Mobile Theme .css location' (string): when you create your own Kendo theme, make sure to also specify the new path of the mobile theme as well.
    5. 'Custom Theme Name' (string): provide the theme name that you want others to see when they look at your own site.
    6. 'Dark Theme' (true/false): Gregory's blog has built in logic to pull in different resources depending upon the overall color of the theme. If the theme has a dark background for example, Gregory's blog will pull in a different version of the code highlighter. There are quite a few different adjustments that are made, but it is up to you to determine whether Gregory's Blog should adjust it's logic for to adapt to a light or a darker screen background. You can see this in action by comparing the following two default themes: Blue Wave (a light theme with dark text) and Blue Wave Dark, a dark theme with white text.
    7. 'Blog Content Width' (numeric): The current blog content is set at 66% of the screen and should be left at this setting unless you set it much higher. When you're looking at the blog, you can see that the blog content portion in the center of the screen. The blog content section may contain the header (we will go over this later), the blog content that contains the blog posts, the side bar to the right which contains the links to the various parts of the site (such as the subscribe interface), and the footer. The blog owner can adjust this as they see fit, they can set it to 100% if they don't want any background image at all. However, unless you want to set this quite a bit higher, it is strongly recommended to leave this particular setting at 66%. If this setting is set at 66%, the background width is programmatically optimized and will change depending upon the screen width of the device. Note: this setting has no effect on mobile devices.
    8. 'Main Container Width' (numeric): the main container holds all of the blog posts. It is currently set at 65% of the Blog Content Width (see above). If you set this higher, or lower, the side bar (also known as the 'pod width') to the right will also be adjusted accordingly. This setting has no effect on mobile devices. Note: the 'Main Container Width' plus the 'Pod Container' width will always equal 100.
    9. 'Pod Container Width (numeric): the pod container is the section to the right of the main container. It contains the subscribe interface, tags, recent posts, etc. The current setting is set to 35%, but you can adjust it as you see fit. Notes: if you change this setting, the Main Container Width will be adjusted accordingly. This setting has no effect on mobile devices. The 'Main Container Width' plus the 'Pod Container' width will always equal 100.
    10. 'Opacity' (numeric): If you look carefully at the site, you can see a faint trace of the background image underneath. I prefer this look as it creates visual interest. The opacity settings are different depending upon the theme, but you can change this setting to your own liking. You can set it at 100% to eliminate the opacity, or set it lower than the current setting if you want the background to bleed through.
    11. 'Background Image' (string): enter the absolute path to the image that you want shown as the background image for the desired theme. If you prefer the look of a clean site without any background, or don't want any background at all, leave this blank. Additionally, you can specify an image that will create a background pattern, and use the next variable, 'Background Image Repeat .css', to create a unique pattern as a background.
    12. 'Background Image Repeat .css' (string): you can use any valid background image repeat .css. This was built into the themes as a blog owner may want to create sophisticated pattern objects for the background.
    13. 'Background Image Position .Css' (string): setting your favorite background 'hero' image using the default 'center center' is not always the best approach. The background image position rule allows you to set the background image to exact coordinates to make sure that it looks good on all screen sizes. See background position for more information.
    14. 'Stretch Header across Page' (true/false): if you want your header to consume the entire width of the page, set this to true. The default setting is false. On mobile devices, this setting is automatically set at 100%.
    15. 'Align Header with Content' (true/false): the default setting is true for all of the current default themes, but setting this to false allows the header to be set at the far left or right of the page, or the absolute center. Leaving this to true adjusts the size of the header to fit the width of the content width (see Blog Content Width).
    16. 'Header Background Image' (string): currently, I use simple images with various gradient fills that are used as the header background. You can set the header background to use any image. You can get creative here, perhaps you want an image that is filled with a pattern, or a header that displays lots of floating bubbles, it is your call.
    17. 'Menu Align' (left, center, right): you can align the header to the left, center, or right. Use this in conjunction with the 'Align Header with Content' or 'Stretch Header across Page' properties to create the look that you like.
    18. 'Cover Menu with Menu Background Image' (true/false): this setting is a bit complex. For my personal 'Zion' and 'Orion' themes, I wanted a the color scheme on the menu to match the color scheme of the background images and the .less theme file that controls the forms and widgets. In order to have the selected menu item match the orange color scheme, I 'covered' the Kendo menu with the background image that I used on the header with .css. This setting allows the menu background image to be shown within the Kendo menu itself. All of the other current themes have this setting set at false. Setting this to false should be sufficient in most cases; the menu is already tailored to the .less based theme that is set. However, there are reasons that a blog owner may want to set this to true on occasion. For example, if a blog owner creates a menu image with a lot of little floating bubbles, setting this to true will also allow the menu items to show these little bubbles as well.
    19. 'Mobile Logo Image' (string): You will want your mobile logo image to be much smaller than the logo image for desktop devices. Enter the absolute location of the image.
    20. 'Mobile Logo Image Width' (numeric (pixel width): this typically is set to be 60 pixels or less.
    21. 'Desktop Logo Image (string): enter the absolute path pointing to the location of your logo that will be shown on desktop devices.
    22. 'Logo Padding (top, right, bottom, left)': you can fine tune the logo placement with these settings. The default settings are left at 0px.
    23. 'Blog Name Text Color' (hexadecimal string): this setting controls the text color of all of the items in the menu. Use any valid hexadecimal or valid HTML color value. If using a hexadecimal value, make sure to put a pound in front of the hexadecimal string it as well.
    24. 'Header Divider Image' (string). This is the horizontal image divider that separates the header and the blog content, and the blog content and the footer. Currently, it is a little grey bar, but you can design your own and specify it here using an absolute path.

      This entry was posted on May 22, 2019 at 9:56 PM and has received 42 views.

      There are currently 0 comments.

    Data types may be different between ColdFusion and jQuery.

    I developed code that gets and sets theme settings from a .ini file. I am using getProfileString and setProfile string to set the various theme properties in a ColdFusion component on the server side. Depending upon the approach that I use, the datatypes that are being returned to the client are different. For example, if I invoke the function from a .cfm page, the values that I am getting are stored in strings, and are being returned as either a 'yes' or 'no'. However, if I invoke the same function from ajax, the value is being returned as a boolean value, i.e. true or false. The component and the method are the same, but the evaluation of the return value is different between ColdFusion and jQuery. Be aware that if you don't declare and set the datatype of the structure elements independently; the datatypes can be interpreted differently depending upon where they are being evaluated.

    This entry was posted on May 18, 2019 at 5:13 PM and has received 9 views.

    There are currently 0 comments.

    JSON Parse Error in jQuery when using a Coldfusion function inside a .cfm page.

    Late at night, I put a function inside a .cfm template and tried to consume it from Ajax, but I received a json parse error that was displayed in Chrome's console when trying to invoke a function within a .cfm page. I had forgot that ajax functions should not be consuming a .cfm page, and placed the exact same function within a component with a .cfc extension, and the issue went away. When a function is within a component with the access remote argument, ColdFusion will autogenerate a web services stub, but it does not do this within a .cfm page. If you receive a json parse error using logic that is known to create a valid json object within a .cfm page, try putting the same code in a .cfc component and consume it there. It may solve this parse error for you as well. The code below has a 'proxyControllerUrl' variable that was initially using a template with a .cfm extension, and it failed. However, when I put the same function within a .cfc extension, it worked.

    view plain about
    1function getAllThemeSettingsFromIniStore(themeId){
    3    // Get all of the theme properties stored in the ini configuration file.
    4    $.ajax({
    5        type: "get",
    6        url: "<cfoutput>#application.proxyControllerUrl#?</cfoutput>method=getAllThemeSettingsFromIniStore",//Works with a .cfc component, fails when the method is inside a .cfm template.
    7        data: { // method and the arguments
    8            themeId: themeId
    9        },
    10        dataType: "json",
    11        cache: false,
    12        success: function (data){
    13            // Pass the data to the getAllThemeSettingsResult function.
    14            getAllThemeSettingsResult(data);
    15        },
    16        error: function(xhr, textStatus, error){
    17            console.log(xhr.statusText);//Parse error shows up here when inside a .cfm template.
    18            console.log(textStatus);
    19            console.log(error);
    20        }
    21    });
    22}//... function

    This entry was posted on May 18, 2019 at 2:26 AM and has received 8 views.

    There are currently 0 comments.

    Set active kendo tab

    There are two standard ways to activate a Kendo tab: 1) via Javascript, or 2) appending the k-state-active class to the HTML list. Both approaches are useful. However, I have had troubles using a javascript function to set the active tab when I had a button open up a new Kendo window, and then set the active tab based upon the URL variable that I sent along when opening up the Kendo window. For some odd reason, when I used the javascript method it would not process the scripts in the second tab. I could not figure out how, or even why, this method failed, but appending the k-state-active class to set the to tab worked just fine. I will share both options below.

    Option 1, use javascript and the select(tabIndex) method:

    view plain about
    1// Set the active tab if it was passed into the URL.
    2var tabName = <cfoutput>'#URL.tabName#'</cfoutput>
    3// Set the active tab if the tab argument is not a null string
    4if (tabName !=''){
    5    // Set the tab
    6    setContractDetailTab(tabName);
    9// function to select the appropriate detail tab.
    10function setContractDetailTab(tabName){
    12    if (tabName == 'contractDetail'){
    13        // Get the index. We are starting at 0, so the first tab will have a zero index.
    14            var tabIndex = 0;
    15        } else if (tabName == 'routing'){
    16            var tabIndex = 1;
    17        } else if (tabName == 'attachment'){
    18            var tabIndex = 2;
    19        }
    21        // Don't perform any actions until the dom is loaded.
    22        $(document).ready(function() {
    23            // Get a reference to the tab.
    24            var detailTabSrip = $("#detailTabSrip").kendoTabStrip().data("kendoTabStrip");
    25            // Select the tab. Make sure to use a timeout otherwise an error will occur and the kendo dropdowns will not be instantiated.
    26            setTimeout(function() {
    27      ;
    28            }, 500);
    30        });    //document.ready
    31    }

    Option 2) use the k-state-active Kendo class to select the active tab:

    view plain about
    1<div id="detailTabSrip" style="height:925px">
    2 <!--- Tab names. --->
    3 <ul>
    4 <li id="contractDetail" <cfif not isDefined("URL.tabName") or URL.tabName eq "">class="k-state-active"</cfif>>
    5     <p>Contract Detail</p>
    6 </li>
    7 <li id="routing" <cfif isDefined("URL.tabName") and URL.tabName eq 'routing'>class="k-state-active"</cfif>>
    8     <p>Routing</p>
    9 </li>
    10 <li id="attachment" <cfif isDefined("URL.tabName") and URL.tabName eq 'attachment'>class="k-state-active"</cfif>
    11 <p>Attachment</p>
    12 </li>
    13 </ul>

    This entry was posted on May 9, 2019 at 2:55 PM and has received 17 views.

    There are currently 0 comments.

    How to get both background and non-background images using the imagesLoaded library.

    I use the imagesLoaded javascript library to determine when and what images are loaded and to provide a status on a pre-loader status screen. The imagesLoaded library has the ability to gather information on background images, and non-background images using the 'background: true/false' argument. If you need to get both background and non-background images, just run it twice switching the background arguments. I highly recommend using this library when you want to provide a 'please wait' dialog and show the load progress of a graphically intense site.

    view plain about
    1// Get the parallax images (non-background images).
    3    background: false
    4}).progress( function( instance, image ) {
    5    loadProgress();
    8// Get the background images in the scenes.
    10    background: true
    11}).progress( function( instance, image ) {
    12    loadProgress();

    This entry was posted on May 8, 2019 at 11:35 PM and has received 16 views.

    There are currently 0 comments.

    Kendo tooltips with multiple classes and styles.

    I had thought that I figured out how to use the Kendo tooltip widget as illustrated in another post, however, I quickly found out that by over-riding the k-tooltip Kendo base class that I could only have one tooltip style for the whole page. Unlike most other Kendo widgets, you can't specify a unique css rule with #divName .k-tooltip { rules... }. As soon as I put in the element name in front of .k-tooltip, everything broke. I thought that I must have made a silly mistake, and tried everything, including the element name after the .k-tooltip class, trying to put in the parent element name, trying to create new custom classes, and appending the class to .k-tooltip, etc, but nothing worked. Time to search the web with google.

    Apparently, Telerik's tooltip design prevents this type of chaining. You can't manually add a class to the tooltip. Instead, we have to use jQuery's addClass to add a class in a function. This particular approach has some issues when the first tooltip is raised (the cutout does not immediately point to the element, and the correct background color may not immediately appear), but otherwise, it works for the most part. I am finally able to have multiple Kendo tooltip styles. Here is my approach. There are a few ColdFusion tags in the example, but the code and comments should be illustrative. A working example of this code is found on my home site at


    view plain about
    1<!--- Tooltip on the left side of the page. --->
    2<div id="aboutThisImage">
    3    <span id="leftTooltip" title="Jenny Lake, Grand Teton National Park." data-desc="This is a majestic trail. But pay attention.... you may come face to face with a Grizzly bear..." class="leftTooltip">
    4        <img src="/images/symbol/aboutGreen.gif" align="center" />
    5    </span>
    6</div><!---<div id="aboutThisImage">--->
    8<!--- Tooltip on the right side of the page. --->
    9<div id="imageLocation">
    10    <!--- Don't show the tooltip on mobile devices. --->
    11    <cfif not session.isMobile><span title="Click to view an interactive map." data-desc="Click on this button to view an interactive map of the Jenny Lake trail." class="rightTooltip"></cfif>
    12        <img src="/images/symbol/mapMarkerButton.gif" align="left" onClick="openMapWindow(0)"/>
    13    <cfif not session.isMobile></span></cfif>
    14</div><!---<div id="imageLocation">--->


    view plain about
    1/* Custom classes for the tooltips. These classes will be used to override the base k-tooltip class. */
    2.leftTooltipStyle {
    3    background: #046FA1 !important; /* Blue matching the left part of the logo */
    4    width: var(--toolTipWidth);
    5    height: var(--toolTipHeight);
    6    font-size: var(--toolTipFontSize);
    7    border-radius: 10px;
    8    /* Subtle drop shadow on the main layer */
    9    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    12/* Custom classes for the tooltips. These classes will be used to override the base k-tooltip class. */
    13.rightTooltipStyle {
    14    background: #698A50 !important; /* Green matching the right part of the logo */
    15    width: var(--toolTipWidth);
    16    height: var(--toolTipHeight);
    17    font-size: var(--toolTipFontSize);
    18    border-radius: 10px;
    19    /* Subtle drop shadow on the main layer */
    20    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    23.tooltipTemplateWrapper h3 {
    24    font-size: <cfif session.isMobile>12px<cfelse>1em</cfif>;
    25    font-weight: bold;
    26    padding: 0px 10px 5px;
    27    border-bottom: 1px solid #e2e2e2;
    28    text-align: left;
    31.tooltipTemplateWrapper p {
    32    font-size: <cfif session.isMobile>12px<cfelse>1em</cfif>;
    33    padding-top: 0px;
    34    padding-right: 10px;
    35    padding-bottom: 10px;
    36    padding-left: 10px;
    37    text-align: left;

    And finally, the javascript:

    view plain about
    1var leftTooltipIntro = $("#intro").kendoTooltip({
    2    // A class can also be used to trigger the popup.
    3    filter: ".leftTooltip",
    4    position: "right",
    5    // Note: we need to use a template as we have created a popup matching the blue notification popups on the right side of the page.
    6    content: kendo.template($("#aboutTemplate").html()),
    7    show: function(e) {
    8        // We also need to override the k-tooltip style with our own class. Otherwise, all of the other tooltips will have the same style. We are differentiating the look of both the right and left tooltip.
    9        this.popup.element.addClass("leftTooltipStyle");
    10    },
    11    // Add animation effects.
    12    animation: {
    13        open: {
    14            effects: "zoom",
    15            duration: 150
    16        }
    17    }
    20var rightTooltipIntro = $("#intro").kendoTooltip({
    21    // A class can also be used to trigger the popup. We can have as many classes as we want separated by comma's.
    22    filter: ".rightTooltip",
    23    position: "left",
    24    // Note: we need to use a template as we have created a popup matching the blue notification popups on the right side of the page.
    25    content: kendo.template($("#locationTemplate").html()),
    26    show: function(e) {
    27        // We also need to override the k-tooltip style with our own class. Otherwise, all of the other tooltips will have the same style. We are differentiating the look of both the right and left tooltip.
    28        this.popup.element.addClass("rightTooltipStyle");
    29    },
    30    // Add animation effects.
    31    animation: {
    32        open: {
    33            effects: "zoom",
    34            duration: 150
    35        }
    36    }

    This entry was posted on May 8, 2019 at 9:10 PM and has received 21 views.

    There are currently 0 comments.

    Kendo template with void to consume a function in an anchor link

    I have a Kendo template that is used to display real time statuses for contracts, and programmed an a href tag that was intended to consume a javascript function rather than opening up a link. On my first attempt, I was having problems as I could not program a pound symbol into the Kendo template (like ColdFusion, a pound symbol indicates a variable within a Kendo template), so I escaped it using two pounds, and found myself struggling to figure out why my window was suddenly being refreshed. I spent around ten minutes stepping through my code only to find out that the a href tag refreshing the entire page, even though it was blank as the double pound sign was escaped. On further introspection, this is understandable as I just had inadvertently programmed a typical link. To fix this issue, I used a simple javascript:void(0); within the link, and the javascript function is called without the default a href tag opening up the link. Essentially, the void(0) code prevents the default behavior of the link, and it acts like a a href="#". I would not typically use void in other code, but using it within a Kendo MVVM template is an appropriate place. Here is the code:

    view plain about
    1<InvalidTag type="text/x-kendo-template" id="myApprovalTemplate">
    2    /* Note: dynamic vars can be displayed like so: #: # */
    3     /* Alternate row colors. */
    4    # if(window.altRow) { #
    5        <tr class='k-alt'>
    6    # } else { #
    7        <tr class='k-content'>
    8         # } #
    9 # if(ApprovalId >
    0){ #
    10     <td class="border">
    11     <input type="checkbox" name="approved#: ApprovalId #" id="approved#: ApprovalId #" value="1" /></td>
    12     <td class="border">#: ApproverTitle #</td>
    13     <td class="border"><a href="javascript:void(0);" onClick="openContractDetailWindow(#: ContractId #, #: ApprovalId #, '')">#: Contract #</a></td>
    14     <td class="border">#: Contractor #</td>
    15     <td class="border">pdf</td>
    16     <td class="border"></td>
    17 #} else {#
    18     <td colspan="6"<!--- class="k-loading-image k-loading-color" --->>
    19     <br/>There are no contracts eligible for you to approve
    20     </td>
    21 #}#
    22     </tr>
    23 <!--- Toggle the window variable. --->
    24 # window.altRow = !window.altRow; #
    25 </script>

    This entry was posted on April 24, 2019 at 7:51 PM and has received 20 views.

    There are currently 0 comments.

    Reopen an existing Kendo window.

    I have been coding thousands of Kendo windows throughout the last several years, and ran into a problem that I have never seen before, and could not find a solution (or even a hit) on google. While coding a window that will hold a Kendo map, I ran into the following error when I opened the window, closed it, and then tried to open it again: Cannot call method 'destroy' of kendoWindow before it is initialized. This error is just not found.

    Type in "Cannot call method 'destroy' of kendoWindow before it is initialized" into google, you won't find a single result. You'll find many other topics, but not one that matches this particular error message. Here is a solution on how I overcame this error, and why I think that it may have happened in the first place.

    My personal website uses a Greensock animation carriage. It is my guess that the errors are due to having a lot of subtle animations there, and it is resource intensive as it has extensive scroll and touch listeners. Along with the Kendo map widget, the site is very resource intensive on the client end. This is probably freezing the destroy methods that are used to typically close a Kendo window. Whatever the actual reason, when I try to destroy the window that contains the map, as I usually do, I run into multiple errors and the window will not open again.

    My approach was to build a function that would check if the window was previously opened, and then closed, to simply re-open it and then refresh the content (it has dynamic content).

    If the window was not already created (by someone opening it), then I would create the window, as usual, but I eliminated Kendo's destroy method when the window is closed. I don't want to destroy it- in fact- I can't. It causes errors.

    If the window was opened, and closed (making the window hidden since it does not have the destroy method), I would re-open the existing window. Here is the code:

    view plain about
    1function openMapWindow() {
    3    $( document ).ready(function() {
    5    /* This is a totally weird approach to open a kendo window. I have coded kendo windows for several years, and have probably coded several hundred windows, but using a Kendo window in this greensock platform, especially with Kendo maps, just does not work. Here, I am testing to see if the window is:
    6    1) defined (the first mapWindow line of code will error out if the window has not already been opened)
    7    2) and if the window is defined, is it hidden (it will be- I am not destroying the window like I always do in other code as I have problems with that here.)
    8    If both conditions ARE true, then I merely reopen the existing window that was hidden when the user clicked on the 'x' at the top of the window.
    9    If both conditions are NOT true, then I create the window as usual (but I don't destroy it as usual as I had problems there too).
    10    Essentially what I am doing is:
    11        - Creating the window if the window was not first opened and then closed.
    12        - Or reopening the window if it was opened and then closed.
    13    */

    14    // This must be put into a try block as the 'var mapWindow =         $("#mapWindow").data("kendoWindow");' will cause errors if the window has not already bee already opened.
    15    try {
    16        // Get a reference to the opened window.
    17        var mapWindow = $("#mapWindow").data("kendoWindow");
    18        // Determine if the window was closed...
    19        var mapWindowIsHidden =":hidden"); //returns true or false
    20        // If the window was closed (and now hidden), re-open the existing window.
    21        if (mapWindowIsHidden){
    22            // Change the title
    23            mapWindow.title(getMapDataByScene(sceneIndex));
    24            // Open it.
    25  ;
    26            // And refresh the window.
    27            mapWindow.bind("refresh", window_refresh);
    28                    }
    29        // Otherwise create the window (for the first time)...
    30        } catch(e) {
    32            // Initialize the window.
    33            var mapWindow = $('#mapWindow').kendoWindow({
    34            title: getMapDataByScene(sceneIndex),
    35            actions: ["Refresh", <cfif not session.isMobile>"Minimize", </cfif>"Close"],
    36            modal: false,
    37            resizable: true,
    38            draggable: true,
    39            pinned: true, // Note: we must pin this window, or it will open at the top of the page at all times when we use this approach.
    40            position: { top: 100 },
    41            width: getGrizzlyWindowWidth(),
    42            height: getGrizzlyWindowHeight(),
    43            iframe: false, // Don't use iframes unless it is content derived outside of your own site.
    44            content: "/includes/layers/map.cfm?sceneIndex=" + sceneIndex,// Make sure to create an absolute path here. I had problems with a cached page.
    45        <cfif session.isMobile>
    46            animation: {
    47                close: {
    48                effects: "slideIn:right",
    49                reverse: true,
    50                duration: 500
    51            }
    52        }
    53    </cfif>
    54    }).data('kendoWindow').center();// Center the window.
    56    }//..try
    59}//..function openMapWindow() {

    Additionally, if you don't need a dynamic window where the content changes, you can simply use the following simple approach:

    view plain about
    1// Dynamic window for the approval routing picker.
    2    // This window also has an id variable.
    3    // Original inspiration provided by Ona Bai (
    4    // To use, first create a div at the top of the page like so: <div id="dynamicDetailWindow"></div>
    5    function dynamicRoutingPickerWindow(id, id2, name, width, height) {
    6        var thisWin = $("#" + name).data("kendoWindow");
    7        if (thisWin) {
    8  ;
    9        } else {
    10            thisWin = $("<div id='" + name + "'></div>").kendoWindow({
    11            actions: ["Minimize", "Maximize", "Refresh", "Close"],
    12            title: "Contract Details",
    13            content: "includes/routingPicker.cfm?contractId=" + id,
    14            width: width,
    15            height: height,
    16            modal: false,
    17            resizable: true,
    18            draggable: true,
    19            // Open the window near the top of the page.
    20            position:{
    21                top:"15%",
    22            },
    23            appendTo: "#dynamicRoutingPickerWindow",
    24            visible: true
    25            }).data("kendoWindow").center();
    26        }
    27 }

    This entry was posted on April 19, 2019 at 12:15 AM and has received 17 views.

    There are currently 0 comments.

    Kendo scrollview

    I have been using the scroll view on my home site at quite a bit, and wanted to pass along a few tips.

    If you want to change the button size on the scroll view, use the following css. The default font-size is around 2em, to make the right and left arrows bigger, use anywhere from 6-8em, and 1em to make the arrows a bit smaller.

    view plain about
    1#nameOfScrollViewDiv .k-scrollview-next span, .k-scrollview-prev span {
    2    font-size: 8em;

    To use the scrollview to display a lot of text, I used the following approach.

    First, we need to use data-role='page' and create a 'white-space:normal' style for every element in order to allow for the text to wrap properly instead of going off of the scrollview page:

    view plain about
    1<div id="developmentScrollView" class="blueGradient">
    2    <!-- This is used for every page -->
    3    <div class="getConnected" data-role="page" style="white-space:normal;">

    To constrain the text and allow the arrows to be seen visibility on the right and left, I created a css class for the div that contains the actual scrollview, and wrapper classes that constrain the text information in the proper spot.

    The class for the scrollview div (the outer class in this case):

    view plain about
    1/* Scroll view outer containers within the content blocks. */
    2#developmentScrollView {
    3    /* Text color */
    4    color: rgba(255, 255, 255, 0.9);
    5    height: var(--scrollViewHeight);
    6    width: var(--scrollViewWidth); /* Don't use dynamic css vars set when the page loads. It screws stuff up. */
    7    margin: auto;    
    8    z-index: 2; /* This needs to be higher than the nav blocks */

    And the three wrapper classes: the first class (firstScrollviewWrapper) is used on the first slide, and the second class (scrollviewWrapper) controls all of the slides after the first and last slide, and the last class (lastScrollviewWrapper) is used for the very last slide. These are used to keep the text separated from the arrows in order to make the arrows more visible.

    view plain about
    1.firstScrollviewWrapper {
    2    position: relative;
    3    display: table;
    4    left: 0%; /* The 2nd and x slides there after start to the right of the left arrow. */
    5    right: 10%;
    6    margin: auto;
    7    width: 80%; /* the width of the scroll view container. */
    8    text-align: left;
    9    font-family: var(--scrollViewFont);
    10    font-size: var(--scrollViewFontSize);
    13.scrollviewWrapper {
    14    position: relative;
    15    display: table;
    16    left: 0%; /* The 2nd and x slides there after start to the right of the left arrow. */
    17    right: 10%;
    18    margin: auto;
    19    width: 80%; /* the width of the scroll view container. */
    20    text-align: left;
    21    font-family: var(--scrollViewFont);
    22    font-size: var(--scrollViewFontSize);
    25.lastScrollviewWrapper {
    26    position: relative;
    27    display: table;
    28    left: 0%; /* The 2nd and x slides there after start to the right of the left arrow. */
    29    right: 0%; /* The last slide does not have a right arrow that we need to leave room for. */
    30    margin: auto;
    31    width: 80%; /* the width of the scroll view container. */
    32    text-align: left;
    33    font-family: var(--scrollViewFont);
    34    font-size: var(--scrollViewFontSize);

    A demonstration of my approach can be seen on my home page.

    Note: I am using css variables for the font family and font size.

    This entry was posted on April 16, 2019 at 7:57 PM and has received 14 views.

    There are currently 0 comments.

    • 1
    • 1
    1 of 3 pages

    Your input and contributions are welcomed!

    If you have an idea, BlogCfc based code, or a theme that you have built using this site that you want to share, please contribute by making a post here or share it by contacting us! This community can only thrive if we continue to work together.

    Images and Photography:

    Gregory Alexander either owns the copyright, or has the rights to use, all images and photographs on the site. If an image is not part of the "Gregory's Blog" open sourced distribution package, and instead is part of a personal blog post or a comment, please contact us and the author of the post or comment to obtain permission if you would like to use a personal image or photograph found on this site.


    Portions of Gregory's Blog are powered on the server side by BlogCfc, an open source blog developed by Raymond Camden. Revitalizing BlogCfc was a part of my orginal inspiration that prompted me to design this site. Some of the major open source contributers to BlogCfc include:

    1. Peter Farrell: the author of 'Lyla Captcha' that is used on this blog.
    2. Pete Freitag: the author of the 'ColdFish' code formatter that is also used on this blog.