簡體   English   中英

保存時extjs ServerProxy錯誤

[英]extjs ServerProxy error on save

我正在嘗試從網格行圖標更新字段值。 但我得到這個錯誤:

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);
        } 
    },......

此外,代理服務器正在為GET請求正常工作。 有誰知道我應該在代理上定義什么? 我已經閱讀了官方文件,但對我來說並不清楚。

您必須為您的模型提供代理。 在按鈕的處理程序中,您調用模型的save方法(SF.model.Content),然后,您的SF.model.Content模型必須提供代理。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM