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

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

1 Answer 154 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 10 Sep 2012, 03:48 PM
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,

1 Answer, 1 is accepted

Sort by
0
Nathan
Top achievements
Rank 1
answered on 23 Oct 2012, 06:47 AM
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
Tags
ListView
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Nathan
Top achievements
Rank 1
Share this question
or