2013-07-27 97 views
3

我們可以配置劍道網格數據源是同步我們可以配置劍道網格數據源是同步

.DataSource(dataSource => 
      dataSource.Ajax() 

    .Model(model => 
    { 
    .Read(read => read.Action("Products_Read", "Home"))) 
    ....... 


    $("#grid").data("kendoGrid").dataSource.read(); 

這是一個Ajax的異步調用。如果可以,我們可以將此呼叫轉到同步呼叫。 請給我一個解決方案。 謝謝。

回答

11

要迫使Kendo數據源進行同步行爲,請使用async配置數據源傳輸:例如,

var datasource = new kendo.data.DataSource({ 
     type: "odata", 
     transport: { 
      read: { 
       async: false, 
       url: function (data) { 
        return "/odata/Product"; 
       }, 
       dataType: "json" 
      }, 
     }, 
    }); 
相關問題