extjs4 store addes get params in the url
Asked Answered
H

1

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

Hixson answered 3/8, 2011 at 10:31 Comment(4)
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.Interface
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 doneHixson
#6061447Zhukov
@Hixson I have doubt, If you have chat permission look thisStent
J
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'
    }
  },
  // ...
Josefjosefa answered 3/8, 2011 at 13:3 Comment(1)
but how can I pass the request body?Pasargadae

© 2022 - 2024 — McMap. All rights reserved.