• Subscribe to this RSS Feed
  • An Overview of the jQuery CSS Framework
    10/10/2009 2:39PM

    In case you're like me an missed this document, here's a link to the jQuery CSS Framework documentation:

    http://jqueryui.com/docs/Theming/API


  • jQuery UI CSS scopes
    10/09/2009 8:25PM

    In the previous version of formVista we had a single jQuery UI installation with a theme roller created theme. 

    Then for each formVista theme we would override key parts of the themeroller theme. This has turned out to be a painful approach. So instead, I'm moving to a setup where we use themeroller to create a full jQuery theme for each formVista theme. It should end up being more maintainable. Time will tell.

    As part of this effort and to avoid some unfortunate interactions between jQuery.UI styles and styles from other components, which in formVista are all dynamically loaded, I decided to try applying a CSS scope (i.e. prefix) to the themeroller generated theme.

    This works fairly well except in the case of dialogs and other popup tags that are direct descendants of the <body> tag. In order to apply the CSS Scope to the dialog, you have to wrap the dialog in a div containing your scope. As mentioned in this blog article over the filament group, you can use:

    $(.selector).dialog().parents(.ui-dialog:eq(0)).wrap(<div class="myScope"></div>);

    to wrap the dialog. 

    The one problem with this approach is that if you happen to be creating a modal dialog, a separate div implementing the modal behavior is created /outside/ of the wrapping div which means it does not get the CSS scope style.

    I'm still working on a solution to this issue. 

    My understanding is that jQuery will have a "helperClass" attribute at some point in the future to address this issue. Until then, I'll have to implement some hack or continue on just using a global style.

    Update 2009-09-10

    I've decided to fall back and punt on the CSS Scope issue for now.

  • Another Javascript RIch User Interface library to watch - ExtJS
    10/05/2009 3:31PM

    An article over at slashdot.org referred to a commercial/open source rich user interface library called ExtJS available at: http://www.extjs.com/.

    As of this writing it is dual licensed under the GPL and a Commercial License, similar to the way formVista is licensed.

    After a cursory glance it seems like a fairly complete toolkit, but at this point I'm committed to continuing on with jQuery for formVista.

  • Xinha WYSIWYG HTMLEditor in jQuery.UI tabs
    10/03/2009 3:17PM

    More complex AJAX/AJSON applications such as Google Maps and the Xinha WYSIWYG HTML Editor do not render correctly when placed into hidden divs, presumably because they cannot correctly get the size of the div. 

    According to the Xinha ticket list, the editor must be visible before it is created otherwise it will be displayed in a broken and frozen state.

    Problem #1: MSIE 6 Xinha in hidden div when size is set to auto

    This can be reproduced by placing the Xinha editor into an unselected tab in a jQuery.UI tab control:

    addsku_xinha2.jpg

    The editor does not size itself correctly to the surrounding div. In addition the editor is frozen.

    Problem #2: MSIE 6.0 Form Element Rendering glitch

    The jQuery.UI documentation offers a solution/workaround described as the oft-left technique which involves moving divs off the visible page instead of setting it to display: none;. Unfortunately under MSIE 6 this approach seems to break when used with something that contains form elements:

    addsku_xinha.jpg

    This occurs after the Description tab containing Xinha has been selected and unselected. The other downside to the off-left technique is that it can confuse screen readers.

    A Work-Around

    Given that it was clearly a sizing problem, I discovered that if you create the Xinha editor using fixed sizing the first problem is solved.This is done by setting the width and height properties of the XinhaConfig object before creating the editor:

    var xinha_config = new Xinha.Config();
    xinha_config.width = "700px";
    xinha_config.height = "300px";

    This solves the first problem.

    The second problem, namely that the editor is frozen, can be solved by noticing that the Xinha method sizeEditor() can called without any arguments. Called in this fasion it recalculates its size based on how it was originally configured. This only seems to work if the editor has fixed sizing.

    So whenever the tab is shown, just call resize. This can be easily accomplished by binding a callback to the tabshow event:

    $('#tabs').bind('tabsshow',
       function( event, ui )
          {
          if ( ui.index == 1 )
             {
             editor.sizeEditor();
             }
          } );

    Assuming you have a global editor object avialable. I like to avoid globals whenever possible so, in formVista, when I process the <htmleditor> FVML tag, I add the editor object to the textarea using the jQuery core data() method as in:

    $('form[name=someform] textarea[name=somefield]').data( "xinha_editors", Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins));

    And then in my callback I just get the editor using:

    var editor = $('form[name=someform] textarea[name=somefield]').data( "xinha_editors" )['somefield'];

    Note that the value stored in the xinha_editors entry is an array of editors per instructions in the Xinha newbie guide. You can certainly do it differently.

    Right now, the FVML <htmleditor> tag is not yet smart enough to know that it's inside a <tabbedcontainer> tag, so I just embed the callback into the FVML using a plain <js> tag. More on doing development in FVML another time.

    Conclusion

    This workaround seems to work in FireFox, MSIE 6, and MSIE 8. I have not yet had a chance to try it in other browsers.

    So in summary, to get the Xinha WYSIWYG HTML Editor to work with the jQuery UI tab control in an unselected tab:

    1. configure Xinha using a fixed size
    2. call sizeEditor() when the tab containing the htmleditor is selected.

    If you find any problems with this workaround or have any questions, please leave comments here or in the forum. (Unfortunately, I don't have anonymous posting built yet, so you'll need to register for an account. See the Register link in the upper right corner.)

  • From a follower on twitter - net-tuts
    09/29/2009 11:25AM
    What appears to be a compelling resource for javascript, jQuery, HTML, PHP and CSS info: http://net.tutsplus.com/