2

all my grids will have in the first column, some image links to edit, delete and open the record.

I can't get this column to be fixed at 80 pixels.

Here is my code:

@(Html.Telerik().Grid(Model)
    .Name("Grid")
    .DataKeys(keys => keys.Add(c => c.Handle))         
    .DataBinding(dataBinding => dataBinding
        .Ajax()
        .Select("AjaxPesquisar", "Especialidade")
        .Update("AjaxAtualizar", "Especialidade")
        .Delete("AjaxDelete", "Especialidade"))
    .HtmlAttributes(new { @class = "grid-padrao" })
    .ClientEvents(events => events
        .OnDataBound("atualizarCss")
    )
    .Columns(columns =>
    {
        columns.Template(@<span><a class="formatacao" href="/Especialidade/Details/238" image="show"></a><a class="formatacao delete-link" href="/Especialidade/AjaxDelete/238" image="delete"></a><a class="formatacao" href="/Especialidade/Edit/238" image="edit"></a></span>).Width(80);
        columns.Bound("Descricao").Title("Descrição");
        columns.Bound("Handle").Title("Código");


    })        
    .Pageable()
    .Sortable()

    )
Beetlejuice
  • 4,292
  • 10
  • 58
  • 84

2 Answers2

4

Column widths work best if the table-layout CSS setting of the table is set to fixed. You can either make your grid Scrollable() or use the following CSS:

<style>
   .t-grid table
   {
      table-layout: fixed;
   }
</style>

You can find more info about tables here.

Atanas Korchev
  • 30,562
  • 8
  • 59
  • 93
0

I have the same issue too! What I did to get it work is to add:

columns.Bound(o => o.YourColumn)
.HtmlAttributes(new{@style="display:inline-block;width:80px;" });

Hope this helps.

Jobert Enamno
  • 4,403
  • 8
  • 41
  • 63