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

Saving existing record or inserting new one

2 Answers 170 Views
ListView
This is a migrated thread and some comments may be shown as answers.
dccxz
Top achievements
Rank 1
dccxz asked on 08 Jun 2012, 02:31 PM
Hello,
I have a ListVIew binded to a DataSource which gets loaded as "json" datatype from a control ajax-wise.
The same control also expects POST request back to save/insert update data to DB.

I have kendoListVIew defined with some delegates, including:
var commentsList = $("#commentsList").kendoListView({
                    dataSource: commSrc,
                    editable: true,
                    template: kendo.template($("#ctemp").html()),
                    editTemplate: kendo.template($("#cedittemp").html())
                }).delegate(".ledit-btn", "click", function(e) { commentsList.edit($(this).closest(".comment-view")); }).
                    delegate(".lsave-btn", "click", function(e) { commentsList.save(); }).
                    delegate(".lcancel-btn", "click", function(e) { commentsList.cancel(); }).data("kendoListView");

There is no e.preventDefault() - because they are DIVs, not hyperlinks.

I was under an impression that calling .save() on listView will cause DataSource to sync - which means it would call update routine defined under transport. But it never does anything actually.
I don't mind calling my own function and do my own ajax postback via delegate(".lsave-btn"), but then how do I pass data from form fields for edited item (or new item)?

Or am I missing something? PLease help :)
Thanks

2 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 13 Jun 2012, 07:54 AM
Hello Ivan,

This is indeed what happens when you call save function. It destroys current editable item and call DataSource.sync, which will process the data back to server etc.

You can see it happen on the demo: http://demos.kendoui.com/web/listview/editing.html

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
dccxz
Top achievements
Rank 1
answered on 13 Jun 2012, 06:16 PM
thanks for reply Nickolay.
I have created a support ticket for this as it gets more involved - my ListVIew and its shared datasource is actually loaded via ajax from Kendo Tabs, so I'm assuming this is where the problem lays.
Tags
ListView
Asked by
dccxz
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
dccxz
Top achievements
Rank 1
Share this question
or