kendo ui grid dropdownlist cannot pass its value while adding a new record -


the below case refers to:http://demos.telerik.com/kendo-ui/grid/editing-custom adding screen works, add failed because of dropdownlist cannot value.

the problem is: when add new record, , select curve term (not default value), dropdown cannot value, is, json backend is: "curvetermid":""

the code below:

    <div id="grid"/>      var datasource = new kendo.data.datasource ({       batch:true,           transport:{         read: function (options) {           $.ajax({             type: "post",             url:"",             data:"/idx/list",             datatype:"json",             contenttype: "application/json; charset=utf-8",             success: function(result) {               options.success(result);             }           })         },         create: function(options) {           $.ajax({             type: "post"             ,url:"/create"             ,datatype:"json"             ,contenttype: "application/json; charset=utf-8"             ,data:kendo.stringify(options.data.models)             ,success:function(result) {               options.success(result);             }           });         },              parametermap:function(options,operation) {             return kendo.stringify(options.models);         }       },       schema:{        data: result.data,        total:result.total,        model:{           id:idkey,           fields:{                idkey:     {type:"number"},               **curveterm: {validation: {required: true}}**           }        }      }   });   $("#grid").kendogrid({       datasource:datasource,       columns: [                {field: "idkey", title: "id"},                **{field: "curvetermid",                  title: "curve term",                 editor: fnddlcurvetermeditor,                  template: "#=curveterm.curvetermname#"}                ]**,       editable:{mode:"popup", confirmation:"are sure want remove item?"}      });    function fnddlcurvetermeditor(container,options) {   var data = [{"curvetermid":0,"curvetermname":"na","isactive":1},    {"curvetermid":1,"curvetermname":"aaa","isactive":1},{"curvetermid":2,"curvetermname":"bbb","isactive":1}];    var ddlvar = $('<input id="curvetermid" name="curvetermid" '        + ' data-value-field="curvetermid" '       + ' data-text-field="curvetermname"'        + ' data-bind="value: ' + options.field + '"/>')   .appendto(container)   .kendodropdownlist({           datatextfield: "curvetermid",     datavaluefield: "curvetermname",     datasource: data   });  } 


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -