Hi,
I am using the JS2 version of Syncfusion ASP.NET MVC controls to implement a search form which picks a set of available reports based on user selections. Matching reports are shown in a list view control.
Here is the Razor code for the reports list:
@Html.EJS().ListView("reports").Enable(true).DataSource(dm =>
{
dm.Url("/Search/FindReports");
}).Query("new ej.data.Query().addParams('account_id', account_id).addParams('report_template_id',report_template_id).addParams('report_date',report_date).addParams('rows',5)")
.Fields(new ListViewFieldSettings {Id = "report_id", Text = "report_title"}).ShowHeader(true).HeaderTitle("Select Report...").Render()
This invokes a server-side method in SearchController called FindReports and all works fine (it returns up to five reports).
However, I want to re-query the data when the user selects something in a dropdown. Here is my client-side event-handler function:
function selectClient(event)
{
account_id = event.itemData.account_id;
$('#reports')[0].ej2_instances[0].dataSource =
new ej.data.DataManager({ url: "/Search/FindReports", adaptor: new ej.data.UrlAdaptor }).executeQuery(new ej.data.Query()
.addParams('account_id', account_id).addParams('report_template_id', report_template_id)
.addParams('report_date', report_date).addParams('rows', 5))
.then(function(e)
{
$('#reports')[0].ej2_instances[0].dataBind();
});
}
This succeeds in re-running the query on the server (I can set a breakpoint and see that happen) - but afterwards the contents of the ListView are empty even though there are five results returned. What do I need to do to get the ListView to display the new results?