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

Clientside sorting issues with null cells

1 Answer 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sid
Top achievements
Rank 1
Sid asked on 01 Aug 2012, 03:59 PM
I've got some problems with the clientside sorting.  It only seems to be where I've got null values inside a column.  Interestingly, it doesn't work in any of the browsers, but it behaves differently, just all of them incorrectly.
@(Html.Telerik().Grid(Model)
.Name("DellGrid")
.DataKeys(keys => keys.Add(m => m.ServiceTag))
.DataBinding(dataBinding => dataBinding
.Ajax()
    .OperationMode(GridOperationMode.Client)
    .Select("Index", "DellSystem")
    .Update("Edit", "DellSystem"))
.Columns(columns =>
{
    columns.Bound(m => m.ServiceTag)
        .Title("Service Tag");
    columns.Bound(m => m.Family)
        .Title("Family");
    columns.Bound(m => m.LOB)
        .Title("LOB");
    columns.Bound(m => m.ModelNumber)
        .Title("Model Number");
    columns.Bound(m => m.ServiceDate)
        .Title("Service Date");
    columns.Bound(m => m.RetireDate)
        .Title("Retire Date");
    columns.Bound(m => m.User)
        .Title("Altiris User");
    columns.Bound(m => m.CurrentUser)
        .Title("Current User");
    columns.Bound(m => m.Whse)
        .Title("Location");
    columns.Bound(m => m.Name)
        .Title("Computer Name");
    columns.Command(commands =>
    {
        commands.Custom("Edit").ButtonType(GridButtonType.Image)
            .ImageHtmlAttributes(new { @class = "t-icon t-edit" })
            .Text("Edit")
            .Action("Edit", "DellSystem");
    }).Width(150);
})
             .Groupable()
             .Sortable()
             .Pageable(page => page.PageSize(20))
)


Also, when you sort a column,  the ImageHtmlAttributes section seems to be lost as I lose my icon for the edit button:
columns.Command(commands =>
{
    commands.Custom("Edit").ButtonType(GridButtonType.Image)
        .ImageHtmlAttributes(new { @class = "t-icon t-edit" })
        .Text("Edit")
        .Action("Edit", "DellSystem");
}).Width(150);

I've attached a few screen shots to demonstrate.

Any ideas?

Thanks,
-Sid.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 06 Aug 2012, 03:35 PM
Hello Sid,

I am afraid that sorting in client operation mode when there are null values is not supported. Because of the way null values are treated the comparer returns a wrong result. A workaround is to convert the null values to empty strings before passing the data to the Grid. This behavior is also enabled in the Kendo Grid for MVC.
The problem with the missing class on the command should be fixed in the latest release and when I tested it on my side, the image is still shown after a client-operation is performed. Which version are you using?

Regards,
Daniel
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Grid
Asked by
Sid
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or