DataSource.sync() doesn't call create after adding a model to a dataSource generated by ASP.NET MVC ListView Helper

2 posts, 0 answers
  1. Arlene
    Arlene avatar
    2 posts
    Member since:
    Nov 2012

    Posted 22 Feb 2013 Link to this post

    Hi Kendo,

    I tried this on and it works fine. Now I have a listView generated by ListView Kendo Helper and I add a model by calling DataSource.add() method, but when I call DataSource.sync() it doesn't call create and I don't see any http activity on my browser's network tab. I copied the code generated by the kendo helper and pasted it into a test html file and it doesn't work neither. It did add the model to the listView but never calls create. Here is my test file:

    <!DOCTYPE html>
            <title>Testing Kendoui dataSource</title>
            <script src=""></script>
            <script src=""></script>
            <script type="text/x-kendo-tmpl" id="template">
                <div data-id = ${CountryCode}> 
                </div >
                $(function () {
                    $("#target").kendoListView ({
                        "dataSource": {
                            "transport": {
                                "prefix": "",
                                "read": function () {
                                "create": function () {
                                "destroy": function () {
                                "update": function () {
                            "type": "aspnetmvc-ajax",
                            "schema": {
                                "data": "Data",
                                "total": "Total",
                                "errors": "Errors",
                                "model": {
                                    "id": "SubaccountId",
                                    "fields": {
                                        "SubaccountId": {
                                            "type": "number"
                                        "CountryCode": {
                                            "type": "string"
                                        "CountryName": {
                                            "type": "string"
                        "template": kendo.template($('#template').html()),
                        "selectable": "single"
                    $('#addButton').bind("click", function () {
                        var ds = $('#target').data('kendoListView').dataSource;

                            SubaccountId: 1,
                            CountryCode: 'US',
                            CountryName: 'United States'

                <button id="addButton">Add Country</button>
            <div id="target"></div>

    I tried with different jquery and kendo version too. No luck.

    How do I make this work.


  2. Daniel
    Daniel avatar
    2230 posts

    Posted 26 Feb 2013 Link to this post


    I posted my reply in the other thread on the same topic. For convenience I am pasting it below:

    A request to the create action will not be made in this case because the field defined as ID is included in the new item. The dataSource uses the ID to determine if the item is new so a request will not be made when specifying a value different then the default one. Remove the "SubaccountId" field from the object should resolve the problem:

    $('#addButton').bind("click"function () {
        var ds = $('#target').data('kendoListView').dataSource;
            CountryCode: 'US',
            CountryName: 'United States'
    Kind regards,
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top