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

Change Grid.editable at runtime

4 Answers 301 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ross Micheals
Top achievements
Rank 1
Ross Micheals asked on 27 Mar 2013, 07:39 PM
A grid being 'editable' can be set during initialization. Can this be set at runtime as well? I have a 'edit' mode that I would like to use to enable/disable editing of the Grid contents. I see in the documentation that Grid.editable can be set at initialization, but I don't see how it can be changed at runtime (after initialization to use the documentation's terms.)

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 28 Mar 2013, 09:23 AM
Hello Ross,

Thank you for getting in touch with us.

I am afraid that what you would like to achieve is not supported. Edit mode of the Grid widget is set during the initialization and cannot be changed after that.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ross Micheals
Top achievements
Rank 1
answered on 28 Mar 2013, 12:22 PM
Bummer. What is the best practice for recreating the grid at run time? I've been using:

    $('#grid').data('kendoGrid').destroy();
    $('#grid').html('<div id="grid"></div>');

Is that sufficient, or is there more I need to do?

0
Accepted
Alexander Valchev
Telerik team
answered on 29 Mar 2013, 11:17 AM
Hi Ross,

The following code will create invalid mark-up:
$('#grid').html('<div id="grid"></div>');

<div id="grid" data-role="grid" class="k-grid k-widget" style="">
    <div id="grid"></div>
</div>

Please consider using jQuery's empty method.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ross Micheals
Top achievements
Rank 1
answered on 29 Mar 2013, 12:30 PM
Great! Glad I asked.
Tags
Grid
Asked by
Ross Micheals
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Ross Micheals
Top achievements
Rank 1
Share this question
or