Is this the actual implementation of kendo grid?
I wanted to have something like:
and my script:
when the grid is loaded, the alert isn't fired until I included these:
is kendo grid's databound event only fired with ajax binding?
what may be a cleaner workaround for this that you might suggest?
I wanted to have something like:
@(Html.Kendo().Grid(Model)
.Name("Foo")
.Events(e => e.DataBound("server_databound"))
)
<script>
function
server_databound(){
alert(
"hey there!"
);
}
</script>
when the grid is loaded, the alert isn't fired until I included these:
.DataSource(ds => ds
.Ajax()
)
is kendo grid's databound event only fired with ajax binding?
what may be a cleaner workaround for this that you might suggest?
5 Answers, 1 is accepted
0
Hello Avitot,
If you are using server binding the Grid is bound on server and serialized and initialized on client. What it means is that it is already data bound. You can simple handle load event of the document( $(document).ready(function() { /*...my closure... */}) ) as any grid action will result in page reload.
Regards,
Nikolay Rusev
the Telerik team
If you are using server binding the Grid is bound on server and serialized and initialized on client. What it means is that it is already data bound. You can simple handle load event of the document( $(document).ready(function() { /*...my closure... */}) ) as any grid action will result in page reload.
Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Avitot
Top achievements
Rank 1
answered on 06 Aug 2012, 07:47 AM
Hi Nikolay,
Thanks for the immediate reply. I want to have this function called on grid data bound:
My grid is in a partial view that loads data upon changing the selected value of a combo box. The page doesn't load with the grid. How would I implement this?
Cheers!
Avitot
Thanks for the immediate reply. I want to have this function called on grid data bound:
function CheckIfEmpty(e) {
if (e.sender._data.length == 0) {
var colspan = e.sender.columns.length;
$(e.sender.tbody).append("<
td
colspan
=
'" + colspan + "'
><
span
> No record(s) found.</
span
></
td
>");
}
}
My grid is in a partial view that loads data upon changing the selected value of a combo box. The page doesn't load with the grid. How would I implement this?
Cheers!
Avitot
0
Hello Avitot,
If I understand you question correctly the following line should be executed immediately after the partial view is loaded.
The above code should be in your partial view, but notice that no args will be passed to the function so e.sender will be undefined.
All the best,
Nikolay Rusev
the Telerik team
If I understand you question correctly the following line should be executed immediately after the partial view is loaded.
$(document).ready(
function
() {
CheckIfEmpty();
});
The above code should be in your partial view, but notice that no args will be passed to the function so e.sender will be undefined.
All the best,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Avitot
Top achievements
Rank 1
answered on 09 Aug 2012, 08:40 AM
Hello Nikolay,
Yes, that's what I meant. If that's so, then the grid helper code:
is not applicable in server bound but only in ajax bound. Then I have to use my other option.
Yes, that's what I meant. If that's so, then the grid helper code:
.Events(e => e.DataBound("anyFunction"))
0
Hello Avitot,
Indeed, client-side events will not be raised in server bound mode.
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/troubleshooting#client-side-events-are-not-raised-in-server-bound-mode
Regards,
Nikolay Rusev
the Telerik team
Indeed, client-side events will not be raised in server bound mode.
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/troubleshooting#client-side-events-are-not-raised-in-server-bound-mode
Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!