Grid setOptions does not render cell template

3 posts, 1 answers
  1. CORNEL
    CORNEL avatar
    44 posts
    Member since:
    Jan 2012

    Posted 06 Sep Link to this post

    Hi Guys,

     

    I'm exploring the kendo grid persisting of state feature, whereby on a user column re-ordering i would save state and re-load it on next page load, so that basically a user can choose to customize the order of columns.

    All fine and dandy till here, except the grid has cell javascript template defined as kendo javascript blocks, and when calling setOptions method the grid state is loaded but the cell templates are not applied.

    Tried a few options but could not make this thing work out of the box. Would like to know if this is a known limitation or bug??

    * Here is sample code of what im trying to acomplish  http://dojo.telerik.com/ifoWA/5

    Cheers!

     

     

     

  2. Answer
    Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    118 posts

    Posted 07 Sep Link to this post

    Hi Cornel,

    The template of the Kendo UI Grid column is lost because it is a function. This is a known limitation of the JSON.stringify() method:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-setOptions

    In addition to the solutions described by the provided documentation reference above, you may choose to keep the column template inline as a string and the JSON.stringify limitation will not affect it.

    For your convenience, I have updated the provided Dojo snippet at:

    http://dojo.telerik.com/iXafA 

    Regards,
    Alex
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  3. Kendo UI is VS 2017 Ready
  4. CORNEL
    CORNEL avatar
    44 posts
    Member since:
    Jan 2012

    Posted 08 Sep in reply to Alex Hajigeorgieva Link to this post

    Hi Alex,

    Many thanks for the informative reply!

    The option to keep the column template is not possible in this case as there is extensive logic in the actual template code block.

    The custom JSON parser looks an interesting solution to overcome native JSON.stringify limitations. One other way i was able to achieve the requirements is by using the grid reorderColumn method to re-arrange columns order on page load.

     

    Cheers!

     

     

Back to Top