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

[Solved] Ajax Grid prevent initial fetch

1 Answer 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
tdekoekkoek
Top achievements
Rank 1
tdekoekkoek asked on 16 Mar 2010, 04:26 PM
Is it possible to use ajax binding, but prevent the initial fetch?  I only want to actually bind when I have some search criteria and pass that in rebind();

Thanks

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 16 Mar 2010, 04:36 PM
Hello tdekoekkoek,

You can subscribe to the OnDataBinding client-side event and prevent it if there is no search criteria. Here is a code snippet:

<%= Html.Telerik().Grid(Model)
        .Name("Grid")
        .ClientEvents(events => events.OnDataBinding("onDataBinding"));
%>

<script type="text/javascript">
function onDataBinding(e) {
    if (!isThereAnySearchCriteria()) {
          e.preventDefault();
    }
}
</script>


Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
tdekoekkoek
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or