Styling a specific GridPanel in codebehind

  1. #1

    Styling a specific GridPanel in codebehind

    Hello,
    spotless theme is very nice but when a grid counts several records only few are shown, because the padding of .x-grid-cell-inner class.

    In my project, grids are renderend fully in code behind, and just few of those needs a change of that class.
    I really don't know how to handle this.

    I created a custom css class which is avaliable in page.

    .extreme-mini-grid {
        padding: 2px 6px !important;
        font-size: 12px !important;
    }
    I would like to override .x-grid-cell-inner's padding and .x-grid-item's font-size.

    Setting in the .cs file the following line nothing changes:
    grid.BodyCls = "extreme-mini-grid";
    how can I do?

    thank you!
  2. #2
    I think I found a solution running outside the codebehind.

    I create new css with this code inside
    #mySpecificGridId .x-grid-cell-inner {
        padding: 2px 6px;
    }
    then I added this line in cs.html file
    @page "{handler?}"
    @model BBros.ExtCookbook.Pages.IndexModel
    @{
    }
    <link rel="stylesheet" href="~/resources/css/myNewCss.css" />
    <ext-section target="Main">
    </ext-section>
    and set the grid id to mySpecificGridId

    If you want you can close this thread marking as solved, anyway if there is a better way to achieve this goal, let me know!
    Thanks!
  3. #3
    Hello @bbros!

    Well, your solution works, if it works for you!

    The grid.BodyCls setting is there, it should work for what it's intended to (or further css tweaking should be necessary). But as per your description, perhaps you need to style the view instead. The grid cells are down in the grid's view rather than just the grid's body. So perhaps if you want with view CSS customizing, you'd get what you needed.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Feb 19, 2014, 12:51 PM
  2. Replies: 3
    Last Post: Jul 07, 2010, 1:28 AM
  3. Show Specific Column in GridPanel
    By sachin.munot in forum 1.x Help
    Replies: 3
    Last Post: Oct 22, 2009, 4:51 AM
  4. [CLOSED] Custom styling and formatting per cell in GridPanel
    By jchau in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 24, 2009, 7:52 AM
  5. Styling grouping GridPanel - Bug?
    By Rod in forum 1.x Help
    Replies: 2
    Last Post: Nov 21, 2008, 5:29 AM

Posting Permissions