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

Grid setOptions sortable = false clear header template UNEXPECTEDLY

1 Answer 238 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
Chris asked on 31 Jan 2018, 04:03 AM

HI

I met a problem about Grid Sortable : 

  Grid setOptions sortable = false clear header template UNEXPECTEDLY.

What's going on ?? Why header template lost ? 
How to avoid this situation or 
how to disable sortable temporary and header template will not be cleared.

Sample Code : 


  View
                columns.Bound(c => c.Column1)
                  .HeaderTemplate
                  (
                    @<text>
                
                    <input type='number' class='k-textbox' onfocus="class1.focusAllDays({ element: this })" style='width: 50px; font-size: small;' />

                    </text>
                  )
                  .Width(280);


  Javascript

    class1 : 

    focusAllDays: function(e)
    {
      var grid = get your grid;
      //
      grid.setOptions({  sortable: false });
    },


Best regards

Chris



 

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 01 Feb 2018, 09:47 AM
Hello, Chris,

The issue occurs because the header template is rendered on the server and after the setOptions method is used the template is lost on the client.

We have an example how this can be resolved for the Toolbar template, but the logic is similar for the header:

https://docs.telerik.com/aspnet-mvc/helpers/grid/how-to/state/grid-preserve-server-toolbar-template-after-set-options

I hope this is helpful.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
Answers by
Stefan
Telerik team
Share this question
or