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

Datasource Update not triggering

1 Answer 190 Views
ListView
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 04 Oct 2013, 08:09 PM
This is my template:
editTemplate: " <tr>\
                        <td class='name'>\
                                <input type='text' value='#: PageName #' class='k-textbox small' />\
                        </td>\
                        <td class='action'>\
                            <a href='\\#' class='icon icon-ok k-update-button' title='Save Changes'></a>\
                        </td>\
                        <td class='action'>\
                            <a href='\\#' class='icon icon-remove k-cancel-button' title='Cancel'></a>\
                        </td>\
                    </tr>",

When I have firebug open and I click save changes (k-update-button) I get no ajax call...my DS defines it, and the GET\DELETE work fine...any idea what it might be???

favsList.kendoListView({
            dataSource: new kendo.data.DataSource({
                transport: {
                    read: {
                        url: f.baseUrl + $medportal.User.UserName,
                        dataType: "json",
                        type: "GET"
                    },
                    update: {
                        url: f.baseUrl + "/Update",
                        dataType: "json",
                        type: "PUT"
                    },
                    destroy: {
                        url: function (data) {
                            var url = f.baseUrl + $medportal.User.UserName + "/" + data.FavouriteID;
                            return url;
                        },
                        dataType: "json",
                        type: "DELETE"
                    }
                },
                batch: false,
                pageSize: 10,
                schema: {
                    model: {
                        id: "FavouriteID",
                        fields: {
                            FavouriteID: { editable: false, nullable: true },
                            Index: { type: "number" },
                            PageName: { type: "string" },
                            Url: { type: "string" }
                        }
                    }
                }
            }),
            template: kendo.template(f.rowTemplate),
            editTemplate: kendo.template(f.editTemplate),
            remove: function (e) {
                var fav = e.model;
                if (fav.FavouriteID === f.currentfavoriteid) {
                    //Reset the Add Button
                    f.setAddState();
                }
            }
        }).data("kendoListView");

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 08 Oct 2013, 09:15 AM
Hi Steve,

This happens because the input element in the edit template is not bound to any of the model fields, so no changes in the model are detected even if you modify the textbox's value. You can bind the input to a filed using the following approach, as shown in the ListView Editing demo:  
<input type="text" class="k-textbox" data-bind="value:PageName" name="PageName"/>

You can find additional information on Value binding here.
 

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Alexander Popov
Telerik team
Share this question
or