gpt4 book ai didi

javascript - 保存时 extjs ServerProxy 错误

转载 作者:搜寻专家 更新时间:2023-11-01 05:13:29 24 4
gpt4 key购买 nike

我正在尝试从网格行图标更新字段 值。但是我得到这个错误:

未捕获的 Ext.data.proxy.Server.buildUrl():您正在使用 ServerProxy,但尚未为其提供 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 请求工作正常。有谁知道我应该在代理上定义什么?我已经阅读了官方文档,但对我来说并不清楚。

最佳答案

您必须为您的模型提供代理。在按钮的处理程序中,您调用模型的保存方法 (SF.model.Content),然后您的 SF.model.Content 模型必须提供代理。

关于javascript - 保存时 extjs ServerProxy 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13235668/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com