Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

Freezing the first column

Last post 08-18-2008 13:50 by WombatEd. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 07-02-2008 10:42

    • asairam
    • Top 150 Contributor
    • Joined on 01-25-2008
    • Points 408

    Freezing the first column

    How do I freeze the first column of the grid? I am able to freeze the headers using StationaryMargins="HeaderAndFooter" property. My grid has 31 columns with date as first column. So when the user scrolls horizontally, the date column should remain pinned/pegged so that the user can make out for which date they are seeing the data. I have attached the screenshot of the grid.

    Have been struggling for sometime. Really appreciate any help.

    Thanks


    • Post Points: 20
  • 07-02-2008 11:26 In reply to

    Re: Freezing the first column

    The grid is designed so that you set the DisplayLayout.UseFixedHeaders = True in conjuction with setting the header for the column you want to have a property of Header.Fixed = True, but as you can read below, it causes issues for some.

    http://forums.infragistics.com/forums/p/3438/37409.aspx#37409

    • Post Points: 20
  • 07-02-2008 12:16 In reply to

    • asairam
    • Top 150 Contributor
    • Joined on 01-25-2008
    • Points 408

    Re: Freezing the first column

    Thanks for that lead. I tried using that and my grid went crazy. So do we have any other means or ways to achieve this?

     Thanks

    • Post Points: 20
  • 07-02-2008 12:26 In reply to

    • WombatEd
    • Top 10 Contributor
    • Joined on 10-30-2007
    • Culver City, CA
    • Points 6,910

    Re: Freezing the first column

    What do you mean "went crazy"?  RockCityGhost's post sounded right to me, so I'd suggest we now fix whatever is actually causing the "went crazy".

    People are more likely to spot a problem if you post your markup, your code (indicating which event handler it's from) and a screen shot of anything that "went crazy".

    Let me know if my post is a "hit" or a "miss" - use the "Answer" button and the star ratings.

    Edward McCarroll
    Applications Developer
    (Available for Hire - Contact Me)

    • Post Points: 35
  • 07-02-2008 13:16 In reply to

    • asairam
    • Top 150 Contributor
    • Joined on 01-25-2008
    • Points 408

    Re: Freezing the first column

    Sure. I thought you are already aware of that behaviour. Attached is the screenshot.

    The headers are missing. The cells are realigned in an ugly fashion like a brickwall.

    Here the ultragrid tag I am using. The properties I used are underlined.

    <igtbl:UltraWebGrid runat="server" ID="MyWebGrid" Height="500px" Width="100%">

    <Bands>

    <igtbl:UltraGridBand>

    <AddNewRow View="NotSet" Visible="NotSet">

    </AddNewRow>

    <RowEditTemplate />

    <RowTemplateStyle BackColor="White" BorderColor="White" BorderStyle="Ridge">

    <BorderDetails WidthBottom="3px" WidthLeft="3px" WidthRight="3px" WidthTop="3px" />

    </RowTemplateStyle>

    <Columns>

    <igtbl:UltraGridColumn AllowUpdate="No">

    <HeaderStyle BackColor="LightGray" />

    <CellStyle BackColor="#E0E0E0">

    </CellStyle>

    <Header Caption="Date,day" Title="Date,day" Fixed="true">

    </Header>

    </igtbl:UltraGridColumn>

    </Columns>

    </igtbl:UltraGridBand>

    </Bands>

    <DisplayLayout SelectTypeCellDefault="Extended" AllowRowNumberingDefault="NotSet" BorderCollapseDefault="Separate" Name="ctl00xMROWebGrid" RowHeightDefault="20px"

    SelectTypeRowDefault="Extended" Version="4.00" AllowColumnMovingDefault="OnServer" StationaryMargins="Header" UseFixedHeaders="true" AllowUpdateDefault="Yes" SelectTypeColDefault="Single" TableLayout="Fixed" AllowColSizingDefault="Free" Section508Compliant="True" ColFootersVisibleDefault="Yes" JavaScriptFileName="" >

    <FrameStyle Cursor="Default" BorderWidth="1px" Width="100%" Height="250px"

    Font-Size="8pt" Font-Names="Verdana" BorderColor="InactiveCaption"

    BorderStyle="Solid">

    </FrameStyle>

    <ClientSideEvents MouseUpHandler="GridClick" ClipboardError="Grid_OnClipboardError"

    CellChangeHandler="CellChange" InitializeLayoutHandler="Grid_InitializeLayout"/>

    <ActivationObject BorderColor="Black" BorderWidth="">

    <BorderDetails WidthLeft="0px" WidthRight="0px" />

    </ActivationObject>

    <FooterStyleDefault BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">

    <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />

    </FooterStyleDefault>

    <RowStyleDefault BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt">

    <Padding Left="3px" />

    <BorderDetails ColorLeft="White" ColorTop="White" />

    </RowStyleDefault>

    <RowAlternateStyleDefault BackColor="WhiteSmoke" TextOverflow="Ellipsis" BorderStyle="Solid" BorderColor="Gray"

    Font-Size="8pt" Font-Names="Verdana" BorderWidth="1px">

    <Padding Left="3px" Right="3px" />

    <BorderDetails WidthLeft="0px" WidthTop="0px" />

    </RowAlternateStyleDefault>

    <FilterOptionsDefault>

    <FilterHighlightRowStyle BackColor="#151C55" ForeColor="White">

    </FilterHighlightRowStyle>

    <FilterDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="11px" >

    <Padding Left="2px" />

    </FilterDropDownStyle>

    <FilterOperandDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid"

    BorderWidth="1px" Font-Names="Verdana,Arial,Helvetica,sans-serif"

    Font-Size="11px">

    <Padding Left="2px" />

    </FilterOperandDropDownStyle>

    </FilterOptionsDefault>

    <HeaderStyleDefault BorderStyle="Solid" HorizontalAlign="Center" BackColor="LightGray">

    <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />

    </HeaderStyleDefault>

    <EditCellStyleDefault CssClass="EditStyle" Height="19px" BackColor="#CCFFFF" BorderStyle="None" Font-Names="Trebuchet MS,Verdana,Arial,sans-serif" Font-Size="9pt">

    </EditCellStyleDefault>

    <AddNewBox>

    <BoxStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">

    <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />

    </BoxStyle>

    </AddNewBox>

    </DisplayLayout>

    </igtbl:UltraWebGrid>


    • Post Points: 20
  • 07-03-2008 12:08 In reply to

    • asairam
    • Top 150 Contributor
    • Joined on 01-25-2008
    • Points 408

    Re: Freezing the first column

    Hi,

    Any idea on what was causing the grid to behave like that when UseFixedHeaders property? Do we have any immediate fix for that? I am in desperate need for that feature.

    Thanks

    • Post Points: 5
  • 07-06-2008 16:01 In reply to

    • WombatEd
    • Top 10 Contributor
    • Joined on 10-30-2007
    • Culver City, CA
    • Points 6,910

    Re: Freezing the first column

    asairam:
    Sure. I thought you are already aware of that behaviour.

    I'm just a developer like you, who's been here a little bit longer.

    asairam:
    The headers are missing.

    Before you added the FixedHeaders tags, what did your column headers look like and from where were they generated?

    asairam:
    cells are realigned in an ugly fashion like a brickwall.

    Look at the differences between your <RowStyleDefault> and <RowAlternateStyleDefault> tags.  (And their sub-tags.)  I see a couple of differences that might impact column alignment.

    Let me know if my post is a "hit" or a "miss" - use the "Answer" button and the star ratings.

    Edward McCarroll
    Applications Developer
    (Available for Hire - Contact Me)

    • Post Points: 20
  • 07-07-2008 16:34 In reply to

    • asairam
    • Top 150 Contributor
    • Joined on 01-25-2008
    • Points 408

    Re: Freezing the first column

    WombatEd,

    Wow, When i removed the differences between <RowStyleDefault> and <RowAlternateStyleDefault> tags, all the rows rendered correctly. I thankyou wholeheartedly and appreciate your patience in examining the tags so close. Now the only problem lies with header and footer. I am dynamically creating the column group headers, column headers and columns. In the footer, I am rendering some content using <DIV> and <HR> tags for showing multiple footer information. Attached are the images.

    Creating the columns:

    UltraGridColumn column = new UltraGridColumn(node.Attributes["code"].Value, strHeaderText, ColumnType.NotSet,null);

    this.myWebGrid.Columns.Add(column);

    Grouping the column headers:

    Infragistics.WebUI.UltraWebGrid.ColumnHeader ch = new Infragistics.WebUI.UltraWebGrid.ColumnHeader(true);

    ch.Caption = objSectionAttributes["name"].Value;

    // set the origin to be on the top most level of the header

    ch.RowLayoutColumnInfo.OriginY = 0;

    ch.RowLayoutColumnInfo.OriginX = j;

    // extend the newly added header over 3 columns

    ch.RowLayoutColumnInfo.SpanX = GetParamNodesCount(nSection, GridParameterType);

    myWebGrid.Bands[0].HeaderLayout.Add(ch);

    Creating column footer: 

    myWebGrid.DisplayLayout.Bands[0].Columns[0].Footer.Caption = "<div style='TEXT-ALIGN: left;'>Average<hr>Maximum<hr>Minimum<hr>Data</div>";

     The attached image shows the headers,footers before and after using the UseFixedHeaders="true" property.

    The problem is : In place of headers and footer, blank space is rendered (marked by red rectangles in the image attached).

    Sorry, If I am confusing you. Please let me know incase you need any more info. I am sure, we can make this work.

    Thank you once again.

     


    • Post Points: 20
  • 07-08-2008 19:12 In reply to

    • WombatEd
    • Top 10 Contributor
    • Joined on 10-30-2007
    • Culver City, CA
    • Points 6,910

    Re: Freezing the first column

    asairam,

    I'm sorry, but I don't see what the problem is.

    It looks like you've shown me how you generate the left-most column, with its header and its footer, but as far as I can see, you're not putting anything in the other headers or footers.  (Which might explain why they're missing.)  Obviously you're doing something to generate row values for more than one column, so I infer that the code samples you've posted are incomplete. 

    Let me know if my post is a "hit" or a "miss" - use the "Answer" button and the star ratings.

    Edward McCarroll
    Applications Developer
    (Available for Hire - Contact Me)

    • Post Points: 20
  • 07-10-2008 9:08 In reply to

    • asairam
    • Top 150 Contributor
    • Joined on 01-25-2008
    • Points 408

    Re: Freezing the first column

    OK. May be I didnt give you a complete picture of the grid. I am rendering the webgrid based on XML which looks like:

    (comments are underlined).

    XML:
    <Root>
    <Section name="Raw Sewage"> //These form the column group
    <Parameters>
    <Parameter units="string" code="SP6" type="input" name="Influent Flow Rate"> //This node becomes a column in webgrid
    <Average>1.0</Average> //This node forms the footer data
    <Maximum>2.0</Maximum> //This node forms the footer data
    <Minimum>3.0</Minimum> //This node forms the footer data
    <Data></Data>//This node forms the footer data
    <day type="value" number="1">0.3</day> //All these become rows in grid 1-30/31(no. of days in month)
    <day type="value" number="2">0.2</day>
    <day type="value" number="3">0.1</day>
    ....<day type="value" number="31"></day>
    </Parameter>
    </Parameters>
    </Section>
    </Root>

    //****Reading above XML and creating a column for each parameter node :***//

    XmlNodeList lstParameter = doc.SelectNodes("//*/*/Parameters/Parameter[@type=\"input\"]");

    foreach (XmlNode node in lstParameter)
    {
    strHeaderText = "<DIV style='width:50px;vertical-align:bottom;WRITING-MODE:tb-rl;filter:fliph flipv;'>(" + node.Attributes["code"].Value.Substring(0, 5) + ")" + node.Attributes["name"].Value.Replace(" ", "<BR>") + "(" + node.Attributes["units"].Value + ")"+ str+ "</DIV>";

     UltraGridColumn column = new UltraGridColumn(node.Attributes["code"].Value, strHeaderText, ColumnType.NotSet,null);
    column.Width = Unit.Pixel(50);
    this.MROWebGrid.Columns.Add(column);

     }

    //***Creating Grid rows for number of days in the month***//

    DateTime dtFrom = new DateTime();

    XmlNodeList lstDays = doc.SelectNodes("//Root/Section[1]/Parameters/Parameter[1]/day");

    for (int i = 0; i < lstDays.Count; i++)
    {
    this.MROWebGrid.Rows.Add();
    this.MROWebGrid.Rows[i].Cells[0].Value = dtFrom.ToString("M/d/yy,ddd");
    this.MROWebGrid.Rows[i].Cells[0].AllowEditing = AllowEditing.No;
    dtFrom = dtFrom.AddDays(1);
    }

    //***Creating the footer:**//

    foreach (XmlNode node in lstParameter)
    {

    XmlNode AvgNode = node.SelectSingleNode("//Root/Section[@name=\"" + node.ParentNode.ParentNode.Attributes["name"].Value + "\"]/Parameters/Parameter[@code=\"" + node.Attributes["code"].Value + "\"]/Average");

    //similarly max, min and data nodes

    System.Text.StringBuilder sbFooterText = new System.Text.StringBuilder();
    sbFooterText.Append("<DIV style='width: 50px;TEXT-ALIGN: left;'>");
    if(AvgNode.InnerText.Equals("")) sbFooterText.Append("&nbsp;"); else sbFooterText.Append(AvgNode.InnerText);
    sbFooterText.Append("<BR><HR>");
    if (MaxNode.InnerText.Equals("")) sbFooterText.Append("&nbsp;"); else sbFooterText.Append(MaxNode.InnerText);
    sbFooterText.Append("<BR><HR>");
    if (MinNode.InnerText.Equals("")) sbFooterText.Append("&nbsp;"); else sbFooterText.Append(MinNode.InnerText);
    sbFooterText.Append("<BR><HR>");
    if (DataNode.InnerText.Equals("")) sbFooterText.Append("&nbsp;"); else sbFooterText.Append(DataNode.InnerText);
    sbFooterText.Append("</DIV>");
    this.MROWebGrid.DisplayLayout.Bands[0].Columns[intIdx].Footer.Caption = sbFooterText.ToString(); ;
    intIdx++;

    }

     

    Hope this gives a complete picture of how I am rendering the grid. Please help!!

     

    • Post Points: 20
  • 07-13-2008 18:26 In reply to

    • WombatEd
    • Top 10 Contributor
    • Joined on 10-30-2007
    • Culver City, CA
    • Points 6,910

    Re: Freezing the first column

    (I'm almost sorry I asked.  I don't speak XML, and I've never attempted to populate footers dynamically.  ;-)

    I'm running low on ideas.  I would double check to make sure you're doing everything within the correct event handler.  I suspect that populating headers, populating footers, and populating rows are best done in two or three different event handlers, but that's just a hunch.

    Sorry. 

    Does anybody else have any ideas?

    Let me know if my post is a "hit" or a "miss" - use the "Answer" button and the star ratings.

    Edward McCarroll
    Applications Developer
    (Available for Hire - Contact Me)

    • Post Points: 20
  • 08-13-2008 21:16 In reply to

    • devip
    • Not Ranked
    • Joined on 04-15-2008
    • Points 70

    Re: Freezing the first column

    When I use UseFixedHeaders=true, it looks good. But when I scroll horizontally all the headers are fixed. I need only the first column header should be fixed and the remaining has to move along with the data. Please help me.

    • Post Points: 20
  • 08-18-2008 13:50 In reply to

    • WombatEd
    • Top 10 Contributor
    • Joined on 10-30-2007
    • Culver City, CA
    • Points 6,910

    Re: Freezing the first column

    Did you set both:

    • Grid.DisplayLayout.UseFixedHeaders = True, and
    • Column.Header.Fixed = True

    If that doesn't help, I'd suggest you post your markup and your code.

    Let me know if my post is a "hit" or a "miss" - use the "Answer" button and the star ratings.

    Edward McCarroll
    Applications Developer
    (Available for Hire - Contact Me)

    • Post Points: 5
Page 1 of 1 (13 items)
Powered by Community Server (Commercial Edition), by Telligent Systems