0

i'm using extjs4 store

In xhtpp calls it shows the http://localhost/home_dir/index.php/questions/content_pie?_dc=1312366604831&hi=&page=1&start=0&limit=25

This is the store code

    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'
    ])
    });

Even though i set the method as POST its get params appears in url

I'm using codeigniter as my framework. I disabled GET params in CI. Iwnat to send params in post. with ext2 and 3 this code worked fine..

Help me

Thanks

nani1216
  • 324
  • 1
  • 10
  • 28
  • Better to paste the code how you are sending params instead of store.As per i know you need to create model in the ExtJS4 the above one which you pasted will not work in ExtJS4. – Kiran Aug 03 '11 at 10:57
  • I'm sending params in this way ' content_type_store.load({params:{hi:''}}); '. I'm new to extjs4 MVC. can You help me how can i get it done – nani1216 Aug 03 '11 at 11:34
  • http://stackoverflow.com/questions/6060947/extjs4-store-baseparams-config-property – Robert Peters Feb 01 '12 at 03:52
  • @nani1216 I have doubt, If you have chat permission [look this](http://chat.stackoverflow.com/rooms/7451/extjs-3-x-4-x-java-script-framework) –  Feb 20 '12 at 11:20

1 Answers1

2

method:'POST' in proxy's config won't work. There is no such config option. However there are two ways to make store use POST. The simplier one - just override getMethod function:

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'
  }
});

The second way: override proxy's actionMethods property. If you choose this way your proxy should look like this:

  // ...
  proxy: {
    type: 'ajax',
    url: BASE_URL+'questions/content_pie',
    extraParams :{hi:''},
    // Here Magic comes
    actionMethods: {
      create : 'POST',
      read   : 'POST',
      update : 'POST',
      destroy: 'POST'
    }
  },
  // ...
Molecular Man
  • 22,277
  • 3
  • 72
  • 89