ListView editing - Adding a new record causes to many records to be shown at once

2 posts, 0 answers
  1. Jeremy
    Jeremy avatar
    2 posts
    Member since:
    Jul 2012

    Posted 10 Sep 2012 Link to this post

    I am attempting to setup an editing listview like the demo found on your site: http://demos.kendoui.com/web/listview/editing.html
    My listview is setup with a pagesize of 2 but everything else is setup identical to this example.

    Currently I have two items in my list and both are displayed when the page is opened.  When the Add new record button is clicked a new edit item is added but the last item in the list is not hidden/removed/paged so there are 3 visible items on my screen.  Is the script call to listView.add(); responsible for paging the last item to the next page or hiding it till save or cancel is pressed?

    Also, the model my listview is based on is part of the page model so my example is declared like this:
    @model IEnumerable<Kendo.Mvc.Examples.Models.Admin>

    @(Html.Kendo().ListView<Kendo.Mvc.Examples.Models.UserInformationModel>()
        .Name("listView")
        .TagName("div")
        .ClientTemplateId("list-view-template")
        .DataSource(dataSource => dataSource
            .Model(model => model.Id("Id"))
            .PageSize(2)
            .Create(create => create.Action("Create", "MyListView"))
            .Read(read => read.Action("Read", "MyListView"))
            .Update(update => update.Action("Update", "MyListView"))
            .Destroy(destroy => destroy.Action("Destroy", "MyListView"))
        )
        .Pageable()   
        .Editable()
    )

    Thanks,
  2. Nathan
    Nathan avatar
    2 posts
    Member since:
    Sep 2012

    Posted 23 Oct 2012 Link to this post

    It has to do with your datasource data structure.
    MVC Wrapper in it's current version is having a real hard time dealing with complex objects (serializing them)
    the main symptom would be when you try adding a new item the listview.
    I've been dealing with this matter myself for over a day now, it sucks but that's the price you pay for using newely developed tech, we're the testing rats ..
    ;)

    Let me know if it's still relevant I'll try to go into more details,
    Cheers,
    Nathan
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top