4

I'm stuck with a problem related to the extraParams of an ExtJS store.. I need to change the default params separator & to a customized ; since the web service I'm accessing doesn't respond to &.

Is there a way to change the separator?

Bests, Andreas

tuc0w
  • 141
  • 1
  • 8

2 Answers2

1

There's nothing built in to ExtJS to allow customisation of the parameter separator - the use of '&' is a de-facto standard, after all.

However, you can change the default behaviour if you need to by overriding Ext.Object.toQueryString

Ext.define('Ext.override.CustomQueryString', {
  override: 'Ext.Object',
  toQueryString: function() {
    var queryString = this.callParent(arguments);
    return queryString.replace('&', ':');
  }
})

Something like that would change behaviour globally. This may or may not be a good thing to do.

Robert Watkins
  • 2,196
  • 15
  • 17
  • Hi Robert, thanks for your comment. Sadly I can't change it globally and I know that & is the standard but I can't change a webservice I didn't wrote. – tuc0w Oct 19 '15 at 10:31
  • Then eschewing the use of the query parameters and hardcoding it into the URL, as per your answer, is the way to go. – Robert Watkins Oct 19 '15 at 11:03
0

I found a workaround on the Sencha forums:

yourStore.proxy.url = 'your/url/' + yourParameter + ';.....';

With this line, before loading the store, it's possible to go around the extraParams and still pass them directly to the used proxy using the url field.

tuc0w
  • 141
  • 1
  • 8