dynamic initialization

2 posts, 0 answers
  1. Morten
    Morten avatar
    321 posts
    Member since:
    Jul 2012

    Posted 12 Mar Link to this post

    I initialize a list view in the ini handler of a bootbox.dialog (http://bootboxjs.com/examples.html) from a button in a grid:

    $("#listview").kendoListView({...

    The content of the dataSource is different from each grid row.

    This initialization happen every time the button is clicked.

    Can/Should I initialize only once and just update the dataSource.

    Thanks in advance

    Regards

    Morten

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2254 posts

    Posted 12 Mar Link to this post

    Hello Morten,

    If the dialog window is not destroyed on closing and if the ListView will have the same templates and configuration for each record, you should be able to only change the dataSource of one single ListView. If the ListView is retrieving the data through AJAX requests you can pass additional data in the "transport.read.data" as function and when the dialog is displayed for different row, you can just call the "read" method of the dataSource to trigger a new request with the additional data for that row:
    Nevertheless, if the dialog is destroyed on close, there will be no noticeable downside of initializing new instance each time.


    Regards,
    Konstantin Dikov
    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.
Back to Top