【问题标题】:extjs4 store addes get params in the urlextjs4 商店在 url 中添加了获取参数
【发布时间】:2011-10-18 23:58:41
【问题描述】:

我正在使用 extjs4 商店

在 xhtpp 调用中它显示http://localhost/home_dir/index.php/questions/content_pie?_dc=1312366604831&hi=&page=1&start=0&limit=25

这是商店代码

    var content_type_store = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({
    url: BASE_URL+'questions/content_pie',
    method:'POST',
    params :{hi:''}

    }),
    reader: new Ext.data.JsonReader({
    root: 'results'
    }, [
    'qtype',
    'qval'
    ])
    });

即使我将方法设置为 POST,它的获取参数也会出现在 url 中

我使用codeigniter 作为我的框架。我在 CI 中禁用了 GET 参数。 Iwnat 在邮件中发送参数。使用 ext2 和 3 这段代码运行良好..

帮帮我

谢谢

【问题讨论】:

  • 最好粘贴代码如何发送参数而不是存储。据我所知,您需要在 ExtJS4 中创建模型,您粘贴的上述模型在 ExtJS4 中不起作用。
  • 我以这种方式发送参数 ' content_type_store.load({params:{hi:''}}); '。我是 extjs4 MVC 的新手。你能帮我怎么做吗
  • @nani1216 我有疑问,如果你有聊天权限look this

标签: xmlhttprequest extjs4 getparameter


【解决方案1】:

代理配置中的method:'POST' 不起作用。没有这样的配置选项。然而,有两种方法可以让商店使用POST。更简单的一个 - 只需覆盖 getMethod 函数:

var content_type_store = new Ext.data.Store({
  proxy: {
    type: 'ajax',
    url: BASE_URL+'questions/content_pie',
    extraParams :{hi:''},
    // Here Magic comes
    getMethod: function(request){ return 'POST'; }

  },
  reader: {
    type: 'json',
    root: 'results'
  }
});

第二种方式:覆盖代理的actionMethods属性。如果您选择这种方式,您的代理应该如下所示:

  // ...
  proxy: {
    type: 'ajax',
    url: BASE_URL+'questions/content_pie',
    extraParams :{hi:''},
    // Here Magic comes
    actionMethods: {
      create : 'POST',
      read   : 'POST',
      update : 'POST',
      destroy: 'POST'
    }
  },
  // ...

【讨论】:

  • 但是如何传递请求正文?
猜你喜欢
  • 2013-01-22
  • 1970-01-01
  • 2011-11-19
  • 1970-01-01
  • 2011-10-14
  • 1970-01-01
  • 2014-04-16
  • 2013-04-20
  • 2015-05-18
相关资源
最近更新 更多