[CLOSED] Vertical Text in EXT.NET Label

  1. #1

    [CLOSED] Vertical Text in EXT.NET Label

    Hi guys,

    I'm trying to use vertically aligned text in Labels in order to enter explanations about certain narrow columns in my gridpanel.

    I can't make the example in this older thread work (and would like to do it differently if possible):

    http://forums.ext.net/showthread.php...-column-header

    But I really don't want to vertically align the text in the gridpanel header, I would rather do it in labels anyway. But all the methods from that thread fail.

    The look I am going for is as follows:

    Click image for larger version. 

Name:	EXT Capture for Vertical Text.PNG 
Views:	62 
Size:	10.1 KB 
ID:	24722

    I have been working on this on and off for two days but I cannot make it work. Here is my examples. I have removed most of the methods I tried (various text aligns and margins) and just put the most basic CSS. No matter what I do the vertical text in the labels is getting horribly mangled.

    I am hoping that there is a quick, obvious solution to this that I am missing. Thank you in advance. I can provide any more info if requested.

    David

    Front end file:
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ForExt.aspx.vb" Inherits="Online_Employee_Review.ForExt" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head runat="server">
        <title></title>
         <script type="text/javascript">
             var handleCheckChange = function (item, rowIndex, record, checked) {
                 if (!checked) return false;
    
                 record.data.Rating1 = false;
                 record.data.Rating2 = false;
                 record.data.Rating3 = false;
             };
        </script>
        <style type="text/css" >
        .verticalLabelText
            {
    		    -webkit-transform: rotate(-90deg);     
    		    -moz-transform: rotate(-90deg);     
    		    -o-transform: rotate(-90deg);     
    		    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);  
    		    transform: rotate(-90deg);
    	    }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Crisp" />
        <ext:Store runat="server" ID="storSteps" AutoSync="true" OnBeforeStoreChanged="StoreChanged" >
            <Model>
                <ext:Model runat="server" >
                    <Fields>
                        <ext:ModelField Name="RatingID" Type="Int" />
                        <ext:ModelField Name="RatingDescription" Type="String" />
                        <ext:ModelField Name="Rating1" Type="Boolean" />
                        <ext:ModelField Name="Rating2" Type="Boolean" />
                        <ext:ModelField Name="Rating3" Type="Boolean" />
                    </Fields>
                </ext:Model>
            </Model>
        </ext:Store>
    
    
        <ext:Viewport runat="server" >
            <Items>
                <ext:Panel runat="server" Layout="FormLayout" >
                <Items>
                <ext:Panel runat="server" Layout="HBoxLayout" Height="150">
                    <Items>
                        <ext:Label runat="server" ID="lblRatingIDPlaceholder" Width="30" />
                        <ext:Label runat="server" ID="lblDescriptionExplanation" Flex="1" Text="Explanation of Description Column" />
                        <ext:Label runat="server" ID="lblRating1Explanation" Width="40" Height="150" Text="Rating 1 Explanation Would Go Here" Cls="verticalLabelText" />
                        <ext:Label runat="server" ID="lblRating2Explanation" Width="40" Height="150" Text="Rating 2 Explanation Would Go Here" Cls="verticalLabelText"/>
                        <ext:Label runat="server" ID="lblRating3Explanation" Width="40" Height="150" Text="Rating 3 Explanation Would Go Here" Cls="verticalLabelText"/>
                    </Items>
                </ext:Panel>
                <ext:GridPanel runat="server" ID="grdSteps" StoreID="storSteps" >
                    <ColumnModel>
                        <Columns>
                            <ext:Column runat="server" DataIndex="RatingID" Width="30" />
                            <ext:Column runat="server" DataIndex="RatingDescription" Flex="1" />
                            <ext:CheckColumn runat="server" ID="chk1" DataIndex="Rating1" Editable="true" Width="40" >
                                <Listeners>
                                        <BeforeCheckChange Fn="handleCheckChange" />
                                    </Listeners>
                            </ext:CheckColumn>
                            <ext:CheckColumn runat="server" ID="chk2" DataIndex="Rating2" Editable="true" Width="40" >
                                <Listeners>
                                        <BeforeCheckChange Fn="handleCheckChange" />
                                    </Listeners>
                            </ext:CheckColumn>
                            <ext:CheckColumn runat="server" ID="chk3" DataIndex="Rating3" Editable="true" Width="40" >
                                <Listeners>
                                        <BeforeCheckChange Fn="handleCheckChange" />
                                    </Listeners>
                            </ext:CheckColumn>
                        </Columns>
                    </ColumnModel>
                </ext:GridPanel>
                </Items>
                </ext:Panel>
            </Items>
        </ext:Viewport>
    
        </form>
    </body>
    </html>
    Code Behind:
    Imports Ext.Net
    
    Public Class ForExt
        Inherits System.Web.UI.Page
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not Ext.Net.X.IsAjaxRequest Then
                Dim listObj As New List(Of Object)
                listObj.Add(New Object() {1, "Step 1", False, False, True})
                listObj.Add(New Object() {2, "Step 2", True, False, False})
                listObj.Add(New Object() {3, "Step 3", False, True, False})
                listObj.Add(New Object() {4, "Step 4", True, False, False})
                listObj.Add(New Object() {5, "Step 5", False, True, False})
    
                storSteps.DataSource = listObj
    
                storSteps.DataBind()
    
            End If
        End Sub
    
        Sub StoreChanged(ByVal sender As Object, ByVal e As BeforeStoreChangedEventArgs)
            Dim quick = 1
    
        End Sub
    
    
    End Class
    Last edited by fabricio.murta; Sep 17, 2016 at 12:32 AM. Reason: no user feedback for 7+ days
  2. #2
    Hello! here's something that might just work for you!

    Please note the code now fits all in one page, I suggest you use this as base for your next examples as it makes it much easier for us to reproduce and provide you feedback!

    <%@ Page Language="vb" %>
    
    <!DOCTYPE html>
    
    <script runat="server">
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not Ext.Net.X.IsAjaxRequest Then
                Dim listObj As New List(Of Object)
                listObj.Add(New Object() {1, "Step 1", False, False, True})
                listObj.Add(New Object() {2, "Step 2", True, False, False})
                listObj.Add(New Object() {3, "Step 3", False, True, False})
                listObj.Add(New Object() {4, "Step 4", True, False, False})
                listObj.Add(New Object() {5, "Step 5", False, True, False})
    
                storSteps.DataSource = listObj
                storSteps.DataBind()
            End If
        End Sub
    
        Sub StoreChanged(ByVal sender As Object, ByVal e As BeforeStoreChangedEventArgs)
            Dim quick = 1
        End Sub
    </script>
    
    <html>
        <head runat="server">
            <title></title>
             <script type="text/javascript">
                 var handleCheckChange = function (item, rowIndex, record, checked) {
                     if (!checked) return false;
    
                     record.data.Rating1 = false;
                     record.data.Rating2 = false;
                     record.data.Rating3 = false;
                 };
            </script>
            <style type="text/css" >
                .x-column-header-last {
                    border-right-width: 1px
                }
                .vertColumn {
                    -ms-writing-mode:tb-rl;
                    writing-mode:vertical-lr;
                    height: 150px
                }
                .vertColumn .x-column-header-inner {
                    width: 100%;
                    padding: 0
                }
                .vertColumn .x-column-header-text {
                    -ms-transform-origin-x: 125px;
                    -ms-transform-origin-y: 70px;
                    transform: rotate(180deg);
                    text-align: left
                }
            </style>
        </head>
        <body>
            <form id="form1" runat="server">
                <ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Crisp" />
                <ext:Store runat="server" ID="storSteps" AutoSync="true" OnBeforeStoreChanged="StoreChanged" >
                    <Model>
                        <ext:Model runat="server" >
                            <Fields>
                                <ext:ModelField Name="RatingID" Type="Int" />
                                <ext:ModelField Name="RatingDescription" Type="String" />
                                <ext:ModelField Name="Rating1" Type="Boolean" />
                                <ext:ModelField Name="Rating2" Type="Boolean" />
                                <ext:ModelField Name="Rating3" Type="Boolean" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
    
                <ext:Viewport runat="server" >
                    <Items>
                        <ext:Panel runat="server" Layout="FormLayout" >
                        <Items>
                        <ext:GridPanel runat="server" ID="grdSteps" StoreID="storSteps" >
                            <ColumnModel>
                                <Columns>
                                    <ext:Column runat="server" DataIndex="RatingID" Width="30" />
                                    <ext:Column runat="server" MenuDisabled="true" DataIndex="RatingDescription" Flex="1" Text="Explanation of<br /> Description Column" Cls="vertColumn" />
                                    <ext:CheckColumn runat="server" MenuDisabled="true" ID="chk1" DataIndex="Rating1" Editable="true" Width="40" Text="Rating 1 Explanation<br />Would Go Here" Cls="vertColumn" >
                                        <Listeners>
                                                <BeforeCheckChange Fn="handleCheckChange" />
                                            </Listeners>
                                    </ext:CheckColumn>
                                    <ext:CheckColumn runat="server" MenuDisabled="true" ID="chk2" DataIndex="Rating2" Editable="true" Width="40" Text="Rating 2 Explanation<br />Would Go Here" Cls="vertColumn" >
                                        <Listeners>
                                                <BeforeCheckChange Fn="handleCheckChange" />
                                            </Listeners>
                                    </ext:CheckColumn>
                                    <ext:CheckColumn runat="server" MenuDisabled="true" ID="chk3" DataIndex="Rating3" Editable="true" Width="40" Text="Rating 3 Explanation<br />Would Go Here" Cls="vertColumn" >
                                        <Listeners>
                                                <BeforeCheckChange Fn="handleCheckChange" />
                                            </Listeners>
                                    </ext:CheckColumn>
                                </Columns>
                            </ColumnModel>
                        </ext:GridPanel>
                        </Items>
                        </ext:Panel>
                    </Items>
                </ext:Viewport>
            </form>
        </body>
    </html>
    I left only the description column with the text not centered. Think from this point you can fix what's left of the example?

    Notice I used CSS cascading except for the 'x-column-header-last' which was a style set in the upper level (dom-wise) of the column header so, that it applies to the columns' borders (which is what I needed to change there). You might specify BaseCls= on the columns definition to use a different css on each column you are adding the turned text.

    Also, I used rotate(180deg) cause I didn't find a better way to make the text start from bottom (direction: rtl / ltr didn't work there). And... just before I posted this I noticed the changes only work on Chrome. Seems IE refused to like the 'writing-mode' CSS rule here. :(

    Leaving it as is for now cause I believe this is the right path to achieve the view you suggested. Similar approach can be done with labels if you really want to use them.

    EDIT: I've edited the CSS on the code above with something that just works for IE11 (at least). It still needs the moving right of the vertical text in the wide 'description' column for Chrome.
    Last edited by fabricio.murta; Aug 18, 2016 at 5:40 AM.
  3. #3

    Thanks for the reply

    Thank you Fabrico, I will not split my examples in the future.

    I have one more question/request: can we do this using labels in a Panel with HBOXLayout? Like in my original example? I am trying to make it work but it keeps getting mangled and I can't figure out what I'm doing wrong.

    Edit: I'm working with the style sheet for labels now, but I'm having a lot of trouble. Particularly because I don't want to change all my headers/labels. I'm using the CSS rules from the previous example (so if my columnID was NewColumn1 I would be editing .x-column-header-last-NewColumn1)

    Edit2: Fabrico, could I ask a big favor? I need a place to go to see what styles are applied via CSS to each EXT.NET component. I just can't find a list of styles for these various controls so that I don't need so many explicit examples. I am desperate for a list of css styles that applied so that I can override them. I admit I am weak in this area of the app but need to get better at it so that I can stop bothering you!
    Last edited by dmoore; Aug 18, 2016 at 6:35 PM.
  4. #4
    Hello David!

    As for the example exploring most components of Ext.NET in one place, I can point you to this one: Introduction - Component Overview.

    As for the labels laid in a container with HBoxLayout, I'm not sure at this point how to help. Did you get any further with your labels idea, based on the headers example provided by us? Maybe if you share on a new post the code showing how far you could get, we could help you stepping forward from the point you stuck.
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Fabrico,

    I am sorry I wasn't clear. I know about the examples - they've helped me a lot.

    The question is: if I wanted to overwrite the style for a basic panel, I would overwrite "x-panel-body" in CSS. But let's say I wanted to overwrite certain Label styles - how would I know which "x-*" stylesheets to edit and overwrite?

    What I would really like is to get a list of all the CSS styles that can be overwritten. So I can correctly apply your column changes to labels. Is there anyway that I can get a list of all these styles for labels, column headers, panels, and other controls?

    Thanks,

    David
  6. #6
    Hello David!

    Well, if you want a full list of all CSS variables used in a theme you can just check out the files in (Triton theme, for example) src/Build/Ext.Net/extjs/packages/theme-triton/build/resources/. In this case the files with the theme-triton-all-debug*.css pattern in their names. But I doubt that it would be helpful as you'd have little to no idea on where that css vars are actually used.

    Another source options include specialized lists of CSS vars grouped by their components in the Sencha official documentation for ExtJS 6.0.2.

    In my opinion the most reliable option would lie in the DOM inspecting of the rendered components using your browser's debugger (actually, the DOM Explorer the various browsers offer in their respective development consoles).

    So if you want to override certain label styles I suggest you: "inspect element", identify the CSS classes bound to the component, and override them.

    Another way, you already know, which is just making a custom class and binding it to the component (the CSS changes will then apply only and only to that specific component).

    I'm not sure I could clarify your doubts, while I hope so, if not, let me know and maybe elaborate more on the question so I can finally help.
    Fabrício Murta
    Developer & Support Expert
  7. #7
    Hello! We didn't hear back from you for some days now. Do you still need assistance in this matter? We will be assuming you don't need more assistance and close this thread in about 7 business days from now if you do not provide any additional feedback.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Label FieldLabel vertical align issue
    By alexot in forum 1.x Help
    Replies: 1
    Last Post: Jan 03, 2012, 1:35 PM
  2. [CLOSED] Label + FieldLabel vertical align inside TableLayout
    By jwf in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 21, 2011, 8:41 AM
  3. [CLOSED] Vertical Button With Text, Or Vertical Tabs
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 21, 2011, 9:43 PM
  4. [CLOSED] Vertical text alignment for LinkButton is off
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 15, 2010, 7:32 PM
  5. [CLOSED] Label text vertical alignment
    By methode in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 17, 2009, 12:04 PM

Posting Permissions