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

model.editable returns true for not defined fields

1 Answer 51 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
László
Top achievements
Rank 1
László asked on 08 Jul 2015, 12:59 PM

Hi,

The kendo.data.Model editable function returns true if a field is not defined. Shouldn't it return false for undefined fields? 

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Kendo UI Snippet</title>
 
 
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>
   
<script>
var Product = kendo.data.Model.define({
    fields: {
        id: {
            editable: false
        },
        name: {
            editable: true
        }
    }
});
var product = new Product();
alert(product.editable("id")); // outputs "false"
alert(product.editable("name")); // outputs "true"
alert(product.editable("name2")); // outputs "true", why???
</script>
</body>
</html>

 

Regards,

Laszlo

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 10 Jul 2015, 08:40 AM

Hello László,

This is due to the fact that editable is true by default as described in the documentation. Therefore, in order to make a field non editable it should be explicitly set to false otherwise it will be editable.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MVVM
Asked by
László
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or