L
L
Lakewake2011-10-08 17:23:03
ExtJS/Sencha
Lakewake, 2011-10-08 17:23:03

ExtJS4, Grid accesses by wrong url when added?

Good afternoon!
Studying the extjs api did not help solve the issue:
There is a grid + store + proxy:

Ext.define('Category', {
        extend: 'Ext.data.Model',
        fields: [
            'id',
            'title',
            'img'
        ]
    });


var proxy = new Ext.data.proxy.Ajax({
            url: '/manage/category/read',
            model: 'Category',
            reader: {
                type: 'json',
                root: 'units'
            }
    });

var store = Ext.create('Ext.data.Store', {
        autoLoad: false,
        autoSync: false,
        autoDestroy: true,
        model: 'Category',
        proxy: proxy
    });

var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
        clicksToMoveEditor: 1,
        autoCancel: false
});

var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        plugins: [rowEditing]
        ....незначащие настройки опущены....
});


store.load();

When adding an entry to the grid:
store.insert(0, new Category());
rowEditing.startEdit(0, 0);
for example with title =1, there is a GET request to /manage/1
Why does this happen - I can't understand? How to change the url or disable the request altogether when adding an element to the grid?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
p4s8x, 2011-10-09
@vedmaka

Pay attention to the "api" parameter

proxy: {
type: 'ajax',
api: {
create: 'store/newData/model/RulesList',
read: 'store/getData/model/RulesList',
update: 'store/setData/model/RulesList',
destroy: 'store/destroyData/model/RulesList'
}
,
reader: {
type: 'json',
root: 'RulesList',
successProperty: 'success',
messageProperty: 'message'
},
writer: {
type: 'json',
writeAllFields: false
},

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question