<script>
var Product = kendo.data.Model.define( {
id: "id", // the identifier is the "id" field (declared below)
fields: {
/* name of the field */ name: {
type: "string", // the field is a string
validation: { // validation rules
required: true // the field is required
},
defaultValue: "<empty>" // default field value
},
/* name of the field */ price: {
type: "number", // the field is a number
validation: { // validation rules
required: true, // the field is required
min: 1 // the minimum value is 1
},
defaultValue: 99.99 // default field value
},
/* name of the field */ id: {
editable: false, // this field is not editable
nullable: true // a default value will not be assigned
}
}
});
var product = new Product();
console.log(product.get("price")); // outputs "99.99" which is the default value
</script>
Kendoui:新建一个model
最新推荐文章于 2021-08-05 19:38:47 发布