Kendo UI Grid function create send Duplicate

0 Answers 149 Views
Grid
valery
Top achievements
Rank 1
valery asked on 31 Jul 2021, 07:39 PM

hello

i don't know why, but my code send a duplicate request to the web API

please help me with this.

 

jquery code:

<body>
 <div id="grid"></div> 
</body>

 <script>


           $(document).ready(function ()
           {

               var dataSource = new kendo.data.DataSource(
                   {
                       autoSync: false,
                       transport:
                       {
                           read:
                           {
                               url: '/api/test/GetAllRecords',
                               dataType: "json"
                           },
                           create:
                           {
                               url: '/api/test/AddNewRecord',
                               dataType: "json",
                               method: "GET"
                           }
                       },
                       schema:
                       {
                           data: "results",
                           model: {
                               id: "PolicyId",
                               fields: {
                                   PolicyId: { type: "number", validation: { required: true, min: 1 }},
                                   PolicyName: { validation: { required: true } },
                                   PolicyDeletionPeriod: { type: "number", validation: { required: true, min: 1 } }

                               }
                           }
                       },
                       pageSize: 100
                   });

               $("#grid").kendoGrid(
                   {
                       dataSource: dataSource,
                       toolbar: [{ name: "create", text: "Create new row" }],
                       editable: "popup",
                       columns: [
                           { field: "PolicyId", title: "PolicyId" },
                           { field: "PolicyName", title: "PolicyName" },
                           { field: "PolicyDeletionPeriod", title: "PolicyDeletionPeriod" }
                       ]

                   });

           });
       </script>
</body>

 

blue is my request the second I don't know why happened

                                
Nikolay
Telerik team
commented on 04 Aug 2021, 11:26 AM

Hi Valery,

Thank you for sharing the Grid declaration.

As far as I can see it looks good and it's hard for me to determine what might be the cause of it without having the full implementation. Could you please share a runnable Dojo demo where the problem is isolated and replicated? Having this will help me fully understand the case and allow me to advise further.

Regards,

Nikolay

No answers yet. Maybe you can help?

Tags
Grid
Asked by
valery
Top achievements
Rank 1
Share this question
or