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

dynamic initialization

1 Answer 135 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Morten
Top achievements
Rank 1
Iron
Iron
Veteran
Morten asked on 12 Mar 2018, 10:13 AM

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

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 12 Mar 2018, 12:56 PM
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.
Tags
ListView
Asked by
Morten
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Konstantin Dikov
Telerik team
Share this question
or