This is a migrated thread and some comments may be shown as answers.

Kendo MVC Grid - remove column sort and title issues

0 Answers 400 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam Gilman
Top achievements
Rank 1
Adam Gilman asked on 21 Aug 2012, 07:01 PM
I'm testing implemention of the Kendo MVC grid control using a server-side model.  My Kendo grid is bound to a model in the view and does not implement any Ajax within the control.  I think I have most of it working correctly now.  I did find that if I'm using .Sortable() on the grid control that it makes all column headers sortable regardless is there is a bound() definied for a column.  Some columns have more complex contents that require Templates.  Some columns I don't want to sort on, but without defining .Bound() I can't used .Sortable(false) on the specific column.

Without a bound defined when I click a column header it throws an unhandled exception for the value being 'undefined'.  I've set a bound on all columns now regardless if it is useful or not.  I also tried to use the .Sortable(false) and it doesn't work.  My column is still allowed to be sorted.  That is issue #1.  Issue #2 is I can't find out to get the header for a column to be completely blank.  If I define .Title(null) or .Title(string.Empty) or .Title("") all still result in a small 1 character underline in the header instead of being blank.  Below is a mock up of my code.  Can you let me know if I'm doing something wrong, if this is something I'll have to wait on for the next release or if there is a temporary workaround?

@(Html.Kendo().Grid(Model.innerModel)
        .Name("Grid")
        .Columns(columns =>
            {
                columns.Bound(p => p.Location).Title("Location");
                columns.Bound(p => p.Date).Title("Date").Format("{0:dd.MM.yyyy}");
                columns.Bound(p => p.Info).Template(@<text>@(Html.Raw(item.InfoHtml))</text>).Title("Complex Info");
                columns.Bound(p => p.moreInfo).Title("More Info");
                columns.Bound(p => p.evenMoreInfo).Title("Schedule");
                columns.Bound(p => p.DetailsId).Sortable(false).Template(@<text><a class='jb-row-detailBtn' href='/Info/Detail/@item.DetailsId.ToString()'>Details</a></text>).Title(string.Empty);
            })
       .Footer(true)
       .Pageable()
       .Sortable()
       .DataSource(dataSource => dataSource
           .Server()
           .PageSize(2)
           .Total(Model.innerModel.Count)
         )
  )

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Adam Gilman
Top achievements
Rank 1
Share this question
or