Martin Borthiry
Martin Borthiry

Reputation: 5326

extjs ServerProxy error on save

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.

Upvotes: 4

Views: 5820

Answers (1)

lontivero
lontivero

Reputation: 5275

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.

Upvotes: 8

Related Questions