mvc grid dynamic binding refresh with different datatables

4 posts, 0 answers
  1. Zhuang
    Zhuang avatar
    3 posts
    Member since:
    Feb 2015

    Posted 06 Mar 2015 Link to this post

    Hi,

    I have a mvc grid binding to data table.

    On web page, I have a dropdownlist, when user select different item, I make a ajax call which returns a different datatable with different columns.

    On ajax success, I do

    $('#GridName').data('kendoGrid').dataSource.data(data);
    $('#GridName').data('kendoGrid').refresh();

    Which normally work if grid is binding to a model, but not this time for dynamic binding

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 10 Mar 2015 Link to this post

    Hello,

    Try using the setOptions method of the grid instead. It will allow you to change the current columns.

    Regards,
    Atanas Korchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. cheng
    cheng avatar
    3 posts
    Member since:
    Aug 2015

    Posted 21 Aug in reply to Zhuang Link to this post

    Hi there,

    I am having the same issue. Please could you tell me if you have resolved your issue. If you did, please show me how you do it.

    I have no idea about using setoptions? Also, the link suggested by support was not very clear to me.

    Please assist me.

  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 24 Aug Link to this post

    Hello cheng,

    When the Kendo UI Grid is initialized with a specific set of columns (specific columns definition) it does not allows columns to be changed without destroying and initializing the Kendo UI Grid with the new set of columns. The easiest way to do that is by using setOptions method - this method does that internally. 

    Regards,
    Boyan Dimitrov
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
Back to Top
Kendo UI is VS 2017 Ready