1. #1
    Ext User
    Join Date
    Nov 2009
    Posts
    2
    Vote Rating
    0
    afs is on a distinguished road

      0  

    Default Setting list and list item styles for Html widget

    Setting list and list item styles for Html widget


    I am trying to use the Ext GWT Html widget to display fragments of HTML that may include lists of ordered and unordered list items.

    I have seen previous posts regarding the setting of the default style for the basic html elements, such as ul, ol and li:

    http://www.extjs.com/forum/showthread.php?t=3630
    http://www.extjs.com/forum/showthread.php?t=83976

    I can appreciate the argument for needing to set the style of the basic elements to minimize cross browser effects.

    The problem I am having is that I cannot figure out how to specify the style rules to get ordered and unordered list items to display numbers and bullets (respectively).

    Playing around with the styles using Firebug, I found that if I disable (click on the circle with diagonal bar) the inherited padding and list-style-type styles I get the default list item markers (which is what I want), or if I explicitly set the padding (e.g. to 20px) and the list-item-style (e.g. to circle) then I also get the desired effect.

    However, I cannot manage to make this work in an Ext GWT program.

    Here is a simple test case:

    Code:
    public void onModuleLoad()
      {
        viewport = new Viewport();
        html = new Html("<div>Ordered List:<ol><li>First Item</li><li>Second Item</li></ol>Unordered List:<ul><li>First Item</li><li>Second Item</li></ul></div>");
        html.setStyleName("test-style");
        viewport.add(html);
        RootPanel.get().add(viewport);
      }
    The documentation for setStyleName says (as displayed by Eclipse, which looks like it is pulling it from the inherited UIObject javadoc):

    Clears all of the object's style names and sets it to the given style. You should normally use setStylePrimaryName(String) unless you wish to explicitly remove all existing styles.


    Next, if I include a style sheet that defines the following styles:


    Code:
    .test-style ul li {
        color: red;
        padding: 20px;
        list-style-type: circle;
    }
    .test-style ol li {
        color: blue;
        padding: 20px;
        list-style-type: decimal;
    }
    And then include a reference to it in my application html:

    Code:
    <link rel="stylesheet" type="text/css" href="resources/css/gxt-all.css" />
    <link rel="stylesheet" type="text/css" href="CB.css" />
    And look at the HTML styles (e.g. for the unordered list item) using Firebug, I get something like:

    Code:
    CB.css (line 1)
    .test-style ul li {
    color:red;
    list-style-type:circle;
    padding:20px;
    }
    gxt-all.css (line 8)
    html, body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, p, blockquote, th, td {
    margin:0;
    padding:0;    /* firebug displays this style with a line through it */
    }
    Inherited from ul
    gxt-all.css (line 8)
    ol, ul {
    list-style-image:none;
    list-style-position:outside;
    list-style-type:none;     /* firebug displays this style with a line through it */
    }
    Firebug shows that the styles are cascading as expected. However, what I see in Firefox (3.0.15 under Ubuntu 9) is the specified color, the specified padding, but no list marker.

    There are lots of moving parts here, so it is possible (likely?) that I've missed something.

    Can anyone tell me how to get the list marker to display, or if there is a better approach altogether?

    Thanks

  2. #2
    Ext User
    Join Date
    Nov 2009
    Posts
    2
    Vote Rating
    0
    afs is on a distinguished road

      0  

    Default


    Creating the original post must of freed my mind... I've now tried a few more things, and it appears that the trick is the padding of the containing div field. If I create a style for the div, I am at last getting the list markers!

    Code:
    .test-style div {
        padding: 20px;
    }

  3. #3
    Ext GWT Premium Member
    Join Date
    Jul 2008
    Posts
    101
    Vote Rating
    0
    Martin.Trummer is on a distinguished road

      0  

    Default


    and it's also been asked here: http://www.extjs.com/forum/showthread.php?t=81940

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi