Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 367
Martin Borthiry Avatar asked Feb 19 '23 14:02

Martin Borthiry


1 Answers

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.

like image 160
lontivero Avatar answered Feb 26 '23 16:02

lontivero