Infragistics Home

Infragistics Forums

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

How set EditCellStyle to RightAlign for some columns

Last post 07-03-2008 7:49 by [Infragistics] Ivan Baev. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-02-2008 4:04

    How set EditCellStyle to RightAlign for some columns

    Hi all,

    In columns containing numeric values I have set the cell and header right align. That looks fine. But if editing, the value keeps left. I can't find the right property to achieve this. I expect something to overwrite the editcellstyledefault for certain columns.

    Thanks for any help

    Markus

    • Post Points: 20
  • 07-03-2008 7:49 In reply to

    Re: How set EditCellStyle to RightAlign for some columns

    Hello Markus,

    Unfortunately only CellStyle is supported for clumns and EditCellStyle is global for the entire band. So while it is still possible to have edit mode align to right, it will be active for the entire band. 

                <igtbl:UltraGridBand>
                        <EditCellStyle CustomRules="text-align: right;">
                        </EditCellStyle>
                        <Columns>
                            <igtbl:UltraGridColumn BaseColumnName="Address" IsBound="True" Key="Address">
                                <CellStyle CustomRules="text-align: right;">
                                </CellStyle>                            
                                <Header Caption="Address">
                                    <RowLayoutColumnInfo OriginX="1" />
                                </Header>
                            </igtbl:UltraGridColumn>
                        </Columns>
                    </igtbl:UltraGridBand> 

    This is still doable though, but a little bit tricky. It requires hooking the AfterEnterEditModeHandler client side event handler, checking if the cell currently edited is in the desired column and if so, changing the alignment of the edit element (Grid Client ID + "_tb") to right. Here is some sample code for that

    <DisplayLayout> 

            <ClientSideEvents AfterEnterEditModeHandler="enterEditMode"/>


    </DisplayLayout>
         
        

        
        <script type="text/javascript">
        
        function enterEditMode(gridName, cellID)
        {
            var cell = igtbl_getCellById(cellID);
            var grid = igtbl_getGridById(gridName);
            var columnKey = cell.Column.Key;               
            var editElement = document.getElementById(gridName + "_tb");        
            
            if (columnKey == "Address")
            {
                editElement.style.textAlign = "right";
            }
            else
            {
                editElement.style.textAlign = "left";   
            }                
        }

     </script>

    Best Regards,
    Ivan Baev
    The Infragistics ASP.NET Team
    • Post Points: 5
Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems