Hi,
I met a strange issue.
In DOM load, I create a kendo grid with remote data source:
There is an ajax form in my page:
I use $("#BindForm").submit() to mannually submit the ajax form.
In BindOnSuccess, I use datasource.get:
Sometimes location which is got from LocationGridDataSource.get(context.id) is NULL, sometimes it will get object successfully.
After my debugging, my questions:
1. The problem is caused by LocationGridDataSource is not ready after ajax returns?
2. Is there a mechanism to ensure I can call LocationGridDataSource.get() based on a READY datasource object?
Any comments or instruction?
Thanks.
I met a strange issue.
In DOM load, I create a kendo grid with remote data source:
$(document).ready(
function
() {
LocationGridDataSource =
new
kendo.data.DataSource({ type:
"json"
...);
LocationGrid = ...
}
There is an ajax form in my page:
@using (Ajax.BeginForm("Bind", "Test", null, new AjaxOptions { OnSuccess = "BindOnSuccess" }, new { id = "BindForm" }))
{}
I use $("#BindForm").submit() to mannually submit the ajax form.
In BindOnSuccess, I use datasource.get:
function
BindOnSuccess(context){
....
var
location = LocationGridDataSource.get(context.id);
var
selection = LocationGrid.table.find(
'tr[data-uid="'
+ location.uid +
'"]'
);
....
}
Sometimes location which is got from LocationGridDataSource.get(context.id) is NULL, sometimes it will get object successfully.
After my debugging, my questions:
1. The problem is caused by LocationGridDataSource is not ready after ajax returns?
2. Is there a mechanism to ensure I can call LocationGridDataSource.get() based on a READY datasource object?
Any comments or instruction?
Thanks.