Local Datasource: Update does not work

2 posts, 0 answers
  1. Labhesh
    Labhesh avatar
    23 posts
    Member since:
    Sep 2015

    Posted 21 Sep 2015 Link to this post

    Hi, 

    I am using treelist under the following scenario:

     

    1) i have a local dataset

    2) While displaying I use column templating

    3) while editing, I create multiple kendo numeric textboxes and appendTo container (code to follow)

    4) I am using Angular

     

    My problem is that the update method never gets called after i submit and edit to my numeric text box within the treelist cell. I.e after hitting Edit --> Update button, the code in update function (Transport: Update called) never gets invoked...What am I doing wrong?

    Also, whats the best way here to update the data and put it back into the grid as well as my datasource?

     

    Note to Admins: Since I am using angular, from below code: please give me an angular compatible answer if possible...

     

    Thanks a lot, 

    Labhesh

    ------------------------

    Here's the code:

     

    <div ng-controller="testcontroller as vm">
        <div kendo-treelist="vm.treelist" k-options="vm.tlOptions"></div>
    </div>

     

    vm.tlOptions = {
        dataSource: {
            transport:{
                read: function(e) {
                    console.log("TRANSPORT: READ Called");
                    e.success(vm.dataToShow);
                },
                update: function(e){
                    console.log("TRANSPORT: UPDATE Called");
                    var updatedItems = e.data;
                    console.log(updatedItems);
                    e.success();
                }
            },
            schema:{
                model: {
                    "id": "sId",
                    "parentId":"sLink",
                    "fields": schemaFlds
                }
            }
        },
        editable:true,
        resizable:true,
        columns: cc
     
    };

     

    NumericEditor attached to each editable column:

     

    var numericEditor = function (container, options) {
     
        $('<input id="abc" style=color:red value='+options.model[options.field].vols.mdl + '"/>')
            .appendTo(container)
            .kendoNumericTextBox({
                decimals: 2,
                format: "n2"
            });
     
        $('<input id="abc" style=color:blue value='+options.model[options.field].vols.usr + '"/>')
            .appendTo(container)
            .kendoNumericTextBox({
                decimals: 2,
                format: "n2"
            });
        $('<label style=color:green>'+options.model[options.field].vols.actual+'</label>')
            .appendTo(container);
     
    };

  2. Labhesh
    Labhesh avatar
    23 posts
    Member since:
    Sep 2015

    Posted 22 Sep 2015 in reply to Labhesh Link to this post

    I figured this one out, for anyone curious to know, I was not binding the textbox's value to dataSource. 

    It can be done by using data-bind in the <input tag...>

     

    var inp = '<input style=color:blue data-bind="value:' + mdl + '"/>';

  3. Kendo UI is VS 2017 Ready
Back to Top