2012-11-05 48 views
4

我正在嘗試更新網格行圖標中的一個字段值。但是,我得到這個錯誤:extjs ServerProxy保存時出錯

Uncaught Ext.data.proxy.Server.buildUrl(): You are using a ServerProxy but have not supplied it with a url.

我使用的是RestProxy,這是店裏的定義:

Ext.define('SF.store.Contents', { 

    requires: [ 
     'SF.Config', 
     'SF.store.RestProxy' 
    ], 

    extend: 'Ext.data.Store', 
    model: 'SF.model.Content', 
    autoLoad: false, 

    proxy: Ext.create('SF.store.RestProxy', { 
     url: (new SF.Config()).getApiBaseUrl() + "admin/contents" 
    }), 

}); 

列代碼上的GridPanel定義

.... 
store: 'Contents',  
..... 
{ xtype: 'actioncolumn', header: 'Action' 
, width: 40 
, items: [{ // Delete button 
     icon: '......./cancel.png' 
     , handler: function(grid, rowIndex, colindex) { 
      var record = grid.getStore().getAt(rowIndex); 
       record.set('status',6); 

      record.save(); //THIS CALL THROWS THE ERROR 

      grid.store.remove(record); 
     } 
    },...... 

在addi代理工作正常,GET請求。有誰知道我應該在代理上定義什麼? 我已閱讀官方文檔,但對我而言並不明確。

回答

8

您必須爲您提供代理模型。在按鈕的處理程序中,您正在調用模型的保存方法(SF.model.Content),那麼,您的SF.model.Content模型必須提供代理。

+1

thanx,使用'grid.store.save();' –

+0

解決所有這些接受ExtJS的答案,沒有人給任何代表 - :/ – phatskat