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

Editable Grid Uncaught ReferenceError: is not defined when adding new email column

1 Answer 1350 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 07 Jun 2012, 06:50 PM
Hi! First of all I want to thank you for creating KendoUI. 

I'm having problem with editable grid here with JSON response from servers... When I click Create it throws an error in Chrome saying  Uncaught ReferenceError: firstName is not defined
This only happens when I'm inserting an email column. But it becomes Okay when I change it back to string. here's the code:

        <script>
                 
var blankData;
                $(document).ready(function () {
                    var dataSource = new kendo.data.DataSource({
                transport: {
         read: {
dataType: "json",
 type: "POST",
data: {"SQLCMD":"SELECT * FROM gridTest","Table":["firstName","nickName","lastName"],"PrimaryKey":"PeopleID"} // this JSON data serves as parameters when returning data from the database
},
         update: {
            type: "POST"
         },
         destroy: {
             type: "POST"
          },
          create: {
              type: "POST"
           }
         },
         // determines if changes will be send to the server individually or as batch
         batch: true,
         //...
 
 
                       pageSize: 30,
                       data: blankData,
                       autoSync: true,
                       schema: {
                           model: {
                             id: "PeopleID",
                             fields:
                                {"PeopleID":{"editable":false,"nullable":true},"firstName":{"type":"email","validation":{"required":true},"nullable":false},"nickName":{"type":"string","validation":{"required":true},"nullable":false},"lastName":{"type":"string","validation":{"required":true},"nullable":false}}                             }
                            
                       }
                    });
 
                    $("#grid").kendoGrid({
                        dataSource: dataSource,
                        pageable: true,
                        height: 260,
                        toolbar: ["create"],
                        columns:
                            [{"field":"firstName","title":"First name"},{"field":"nickName","title":"Nick Name"},{"field":"lastName","title":"Last name"},{"command":"destroy","title":" ","width":"110px"}]                            ,
                        editable: true
                    });
                });
 
 
            </script>



I hope you can help me with this... Thanks!

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 08 Jun 2012, 08:01 AM
Hello Mike,

The dataSource does not support field type "email", the available types are number | string | boolean | date. By default type is set to string. You will find more information and code snippet example in the corresponding documentation. I hope this helps.

Greetings,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or