admin管理员组

文章数量:1320594

I'm trying to update a field value from a grid row icon. But I get this error:

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

I'm using a RestProxy, this is the store definition:

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"
    }),

});

column code on GridPanel definition

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

In addition, the proxy is working fine for GET request. Does anyone knows what should I define on the proxy? I've read the official doc but it is not clear for me.

I'm trying to update a field value from a grid row icon. But I get this error:

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

I'm using a RestProxy, this is the store definition:

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"
    }),

});

column code on GridPanel definition

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

In addition, the proxy is working fine for GET request. Does anyone knows what should I define on the proxy? I've read the official doc but it is not clear for me.

Share Improve this question edited Nov 5, 2012 at 16:00 Martin Borthiry asked Nov 5, 2012 at 15:54 Martin BorthiryMartin Borthiry 5,32610 gold badges43 silver badges59 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

You have to provide a proxy for you model. In the button´s handler you are calling the model's save method (SF.model.Content) then, your SF.model.Content model has to provide a proxy.

本文标签: javascriptextjs ServerProxy error on saveStack Overflow