PDA

View Full Version : How to set pageParam to undefined using Architect?



1 Aug 2012, 8:54 AM
Working with Ext.data.proxy.Ajax, we'd like to disable the 'page' URL parameter. According to the docs we need to set pageParam to undefined, but we can't figure out how to accomplish this using Architect. Entering the word undefined in the value field of the configuration panel results in the pageParam being set to a quoted string 'undefined'.

I understand we could just fire up and editor and directly change the .js file, but that gets overwritten by all subsequent save operations from within Architect.

(http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.proxy.Server-cfg-pageParam (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.data.proxy.Server-cfg-pageParam)).

jojopad
3 Oct 2012, 1:37 AM
Here's my workaround on how to set the pageParam property to undefined.

1. Add a "beforeload" event binding to the store object.
2. Inside the beforeload function:

store.proxy.pageParam = undefined;
store.proxy.limitParam = undefined;
store.proxy.startParam = undefined;

5 Sep 2013, 6:38 AM
Hi!

Sorry, but this didn't work for me!
Is there another possibility to turn of the parameters?

Here's my generated code:


Ext.define('Example.store.EmployeeStore', {
extend: 'Ext.data.Store',

requires: [
'Example.model.Employee'
],

constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
model: 'Example.model.Employee',
storeId: 'MyJsonPStore',
proxy: {
type: 'jsonp',
noCache: false,
pageParam: 'undefined',
url: 'http://localhost/ExampleService/tester',
reader: {
type: 'json'
}
},
listeners: {
beforeload: {
fn: me.onJsonpstoreBeforeLoad,
scope: me
}
}
}, cfg)]);
},

onJsonpstoreBeforeLoad: function(store, operation, eOpts) {
store.proxy.pageParam = undefined;
store.proxy.limitParam = undefined;
store.proxy.startParam = undefined;
store.proxy.callback = undefined;
}

});

Edit:
even if i change the service to receive the Params like


[OperationContract]
[WebGet(
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
UriTemplate = "tester?page={page}&start={start}&limit={limit}&callback={callback}"
)]
Employee tester(string page, string start, string limit, string callback);


i get an "Uncaught SyntaxError: Unexpected token :"


what i'm doing wrong?

thanks and regards