aligning headeritems in gridpanel column

  1. #1

    aligning headeritems in gridpanel column

    Hi,

    I have a CheckColumn inside a columnmodel of a grid panel, like:

    .ColumnModel
                    (
                        X.Column().Text("Name").DataIndex("Name"),
                        X.CheckColumn().Width(20).Text("IsEnabled").DataIndex("IsEnabled").StopSelection(false).Editable(false).Filterable(false)
                        .HeaderItems(
                                Html.X().Container()
                                .Items(
                                    Html.X().Button()
                                        .ID("BulkUpdate")
                                        .Icon(Icon.GroupEdit)
                                        .ToolTip("Bulk Update")
                                        .Handler("bulkUpdate")
                                )
                        )
                        ,
                        X.ImageCommandColumn().Commands
                        (
                            X.ImageCommand().CommandName("Edit").Icon(Icon.NoteEdit)
                        )
                        
                    )
    I just want to center align the button inside header items collection(above). Currently it is left aligned. How to do that?
    Secondly, I am using ImageCommandColumn in above code and that is also left aligned on the grid, and I am not getting any way make it center or right align as well.

    Please help,
    Thanks
  2. #2
    Add
    .StyleSpec("text-align: center")
    to your X().Containter() specification.

    I hope this helps. :)

    EDIT: Alternatively (I would like it more the solution above, but this also works):
        @Html.X().Container().Layout(LayoutType.HBox).Items(
            new List<AbstractComponent> { 
                { Html.X().Container().Flex(1) }, // left pad (dynamic size, weight 1)
                { Html.X().Button().Icon(Icon.GroupEdit) }, // your button
                { Html.X().Container().Flex(1) } // right pad (dynamic size, weight 1)
            }
        )
    Last edited by fabricio.murta; Jan 25, 2015 at 3:49 PM.
  3. #3
    Hello!

    I didn't test, but this should work as well.
    @(X.Container()
        .LayoutConfig(new HBoxLayoutConfig { Pack = BoxPack.Center })
    )

Similar Threads

  1. [CLOSED] Column Header Group w/Filter in HeaderItems
    By jwhitmire36 in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 22, 2014, 5:19 AM
  2. [CLOSED] how to align HeaderItems ?
    By tobros in forum 2.x Legacy Premium Help
    Replies: 15
    Last Post: Jul 15, 2013, 5:16 AM
  3. [2.0]Performance of grid headeritems.
    By howardyin in forum 2.x Help
    Replies: 0
    Last Post: Oct 30, 2012, 8:38 AM
  4. [CLOSED] aligning ccheckbox in status bar
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 16, 2011, 2:12 PM
  5. aligning form objects
    By craig2005 in forum 1.x Help
    Replies: 2
    Last Post: Jan 06, 2011, 3:25 AM

Posting Permissions