How to prevent the first binding on page load of ListView MVC

7 posts, 1 answers
  1. moti
    moti avatar
    27 posts
    Member since:
    May 2011

    Posted 29 Aug 2012 Link to this post

    Hi,

    I'm Using ListView MVC Wrapper and i want to prevent the first binding on page load

    i try to use e.preventDefault() in the RequestStart of the DataSource Event of the ListView, this is not working
    i cant fint .AutoBind(false) Like the DropDownList control Has....

    i didnt find nothing in the documentation or forums both ListView and DataSource

    Thanks
    var g_firstLoading = true;
    function ListView_RequestStart(e) {
    if (g_firstLoading) {
    e.preventDefault()
    g_firstLoading = false;
    return;
    }
    }
  2. Nohinn
    Nohinn avatar
    167 posts
    Member since:
    Feb 2011

    Posted 29 Aug 2012 Link to this post

    Maybe the wrapper is not up to date and it does not have the autobind option (I don't know for sure).
    But if you want it asap, the kendo ui framework does have an autoBind option for the listview.
    The only drawback is that you should write yourself the html code for the control and the javascript code.
  3. Kendo UI is VS 2017 Ready
  4. moti
    moti avatar
    27 posts
    Member since:
    May 2011

    Posted 29 Aug 2012 Link to this post

    Thanks for your answer.
    i do use the latest build of kendo UI.

    if i can use on  page load

    var listObj = $("#MyListView").data("kendoListView");
    listObj.options.autoBind = false;

    but listObj in undefined on page load...

    if there is a way to set this before the RequestStart Happened.



  5. Nohinn
    Nohinn avatar
    167 posts
    Member since:
    Feb 2011

    Posted 29 Aug 2012 Link to this post

    You should create the control via javascript not with the wrapper:
    $("#MyListView").kendoListView({
        dataSource: {
            transport: {
                read: {
                    url: 'yoururlhere'
                }
            }
        },
        autoBind: false
    });
    This would be a very basic listview, it would create the control but no data would be retrieved until you call the read method of the dataSource.
  6. moti
    moti avatar
    27 posts
    Member since:
    May 2011

    Posted 29 Aug 2012 Link to this post

    i know that, but i'm using the MVC wrapper for some reasons.

    i wish the Kendo Team will response to that issue and maybe they will have a solution for that
    or maybe they can publish new build of the Kendo UI for MVC that solve that issue

    Thanks for your response
  7. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 03 Sep 2012 Link to this post

    Hello Mordehay,

    .AutoBind(false) was recently added to ListView wrapper configuration. You can try with latest internal build where this options should be available.

    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!
  8. moti
    moti avatar
    27 posts
    Member since:
    May 2011

    Posted 03 Sep 2012 Link to this post

    Hello Nikolay,

    That is great! i'll try it soon

    Thanks for the quick response to add this feature.

    Best Regards,

    Moti

Back to Top
Kendo UI is VS 2017 Ready