2013-08-16 8 views
5

come mai quando faccio clic sul pulsante di aggiornamento popup della griglia di kendo, questo errore si verifica?SyntaxError: missing; prima dell'affermazione in kendoui

  • L'errore in Firefox browser è in questa forma: SyntaxError: missing ; before d.0=value

  • e in Chrome del browser: Uncaught SyntaxError: Unexpected number

Ho caricato un video per quanto riguarda questo errore per elaborazione n roba

Jsfiddle Code

Video

Codice

transport: { 
    read: { 
     url: 'https://dl.dropboxusercontent.com/sh/u9oxg5f6uweqh40/CbR3pNVg04/documentj', 
     dataType: 'json', 
     type: 'get', 
     cache: false 
     }, 
    update: function(e) { return true; } 
} 
save: function (e) { 
    var that = this; 
    $.ajax({ 
     url: '/echo/json', 
     type: e.model.id == null ? 'POST' : 'PUT', 
     contentType: 'application/json', 
     dataType: 'json', 
     data: JSON.stringify(e.model), 
     success: function (data) { 
      // Alertify.log.success(data); 
      console.log('ok dadasaved'); 
      that.refresh(); 
     }, 
     error: function (data) { 
      // Alertify.log.error(data); 
      console.log('no datasaved'); 
      that.cancelRow(); 
     } 
    }); 
} 
+0

È necessario chiamare almeno options.success nella definizione transport.update. C'è un esempio funzionante nella documentazione: http://docs.kendoui.com/api/framework/datasource#configuration-transport.update –

+0

In te JSFiddle fai clic sul pulsante "Tidy up" ed eseguilo di nuovo – OnaBai

+0

Ho fatto clic su un "Tidy Up" –

risposta

2

Si dovrebbe fornire più codice per rilevare cosa c'è di sbagliato con il codice, ma leggere this possono aiutare:

Such error occurs when the transport definitions are inconsistent. In other words, if you would like to use custom transport method, all transport types should be defined as functions.

Having a standard read transport and custom update is not supported. Please configure all transports as functions and let me know if the error still occurs.

1

ho avuto la stesso errore e per me il problema era che l'opzione dataType non è stato impostato per tutti i metodi transport. Ho contrassegnato tale riga con un commento di seguito:

var linksDataSource = new kendo.data.DataSource({ 
    transport: { 
     read: { 
      dataType: "json", 
      url: 'read-url', 
      type: "get" 
     }, 
     destroy: { 
      dataType: "json", /* <============ THIS LINE WAS MISSING */ 
      url: 'delete-url', 
      type: "delete" 
     }, 
     update: { 
      dataType: "json", 
      url: 'update-url', 
      type: "post" 
     }, 
     create: { 
      dataType: "json", 
      url: 'create-url', 
      type: "post", 
      complete: function() { 
       $("#searchResult").data("kendoGrid").dataSource.read(); 
      } 
     }, 
/* ... */ 
+0

Questo era il mio problema. Grazie – Quiver