PDA

View Full Version : extjs 30-rc1.1 JSONReader not behave like it should behave



pcrombach
6 May 2009, 1:57 AM
Switching my webapp to ExtJS 3.0 RC1.1 did not work.
Let me start with a positive message. My webapp seems to be faster now.

But at the point the app must show some grids this happens:

proxy: new Ext.data.HttpProxy({
url: 'atbGridBackend.php',
method: 'POST'
}),

The URL is send with method: GET. In firebug I see the method = GET and all parameters added to the URL.

atbGridBackend.php?_dc=1241603489956&start=&limit=25&userProfielId=323&task=LISTING&filterValue1=LFM&filterTxt1=Profiel&sort=gebruikersprofiel.Id&dir=ASC&xaction=load

The paramter xaction=load is not set by the app???
Another annoying thing is that the Start parameter is still empty. I read in this forum that this would be solved in the next patch release.

In ExtJS 3.0 and ExtJS 2.2.1 is working correctly with this.

I guess there must be something happened with releasing 3.0 RC 1.1????

Condor
6 May 2009, 5:33 AM
Yes, both problems have been fixed in the Ext 3 SVN branch, but only after Ext 3 RC1.1 was released.

You'll have to wait for the next Ext 3 release or build one yourself from SVN (if you have a support subscription).

stillema
6 May 2009, 1:42 PM
Yes, both problems have been fixed in the Ext 3 SVN branch, but only after Ext 3 RC1.1 was released.

You'll have to wait for the next Ext 3 release or build one yourself from SVN (if you have a support subscription).

I just downloaded revision 3910 and I'm still seeing the xaction parameter being forced in by the Store execute function:


this.proxy.request(action, rs, Ext.apply(options.params || {}, this.baseParams, {xaction: action}), this.reader, this.createCallback(action, rs), this, options);I had to override this function to remove the parameter applied here.

Also, the same with HttpProxy in 3910.

For HttpProxy doRequest function I had to replace:



Ext.apply(o, this.conn);


with



Ext.applyIf(o, this.conn);

Condor
6 May 2009, 10:15 PM
Rev. 3910 contains:

Ext.applyIf(o, this.conn);

ps. But I can see the problem with the xaction parameter. Maybe you should create a 3.0 bugreport.

stillema
7 May 2009, 5:59 AM
Doh! You are correct on the applyIf -- sorry for the confusion.

stillema
7 May 2009, 7:47 AM
Actually, there is still a problem with the HttpProxy code, but I had my code backwards above. I've replied to this thread in order to not keep multiple threads going at once:

http://www.extjs.com/forum/showthread.php?t=67680

pcrombach
9 May 2009, 2:29 AM
Hi, Especially to Condor.

Its a pitty that all users that don't have SVN have to wait until the next release. Problably there are several hundred users and not to forget all new users who dont understand why the grid don't work. They don't work if the start-parameter is empty. Somewhere I read that Jack called the grid in ExtJS a key-component. I expect from a key-component at least that it work like it should be.

Ok I can switch back to ExtJS 2.2.1

PS Is the patch to solve this problem so complicated. Can I patch it myself in the ExtJS 3.0 lib??? I want to test ExtJS 3.0 on my webapp. As I said the webapp seems to run faster with ExtJS 3.0. Also I want to use some new (3.0) features in my webapps the sooner the better.

Condor
9 May 2009, 3:30 AM
It's difficult to post a patch, because the Ext.data.DataProxy constructor needs fixes.

Try if this patch works:

Ext.apply(Ext.data.Api, {
prepare: function(api) {
for (var action in api) {
if (typeof(api[action]) == 'string') {
api[action] = {
url: api[action]
}
}
}
}
});

var p = Ext.data.DataProxy.prototype;
Ext.data.DataProxy = function(conn){
conn = conn || {};
this.api = conn.api;
this.url = conn.url;
if (this.api) {
var valid = Ext.data.Api.isValid(this.api);
if (valid !== true) {
throw new Error('Ext.data.DataProxy#constructor recieved an invalid API-configuration "' + valid.join(', ') + '". Please ensure your proxy API-configuration contains only the actions "' + Ext.data.Api.getVerbs().join(', '));
}
Ext.data.Api.prepare(this.api);
}
else {
this.api = {};
this.api[Ext.data.Api.CREATE] = undefined;
this.api[Ext.data.Api.READ] = undefined;
this.api[Ext.data.Api.UPDATE] = undefined;
this.api[Ext.data.Api.DESTROY] = undefined;
}
this.addEvents(
'before'+Ext.data.Api.READ,
Ext.data.Api.READ,
'beforewrite',
'write'
);
Ext.data.DataProxy.superclass.constructor.call(this);
};
Ext.extend(Ext.data.DataProxy, Ext.util.Observable, p);
Ext.data.HttpProxy.superclass = Ext.data.DataProxy;

Ext.override(Ext.data.DataProxy, {
setApi : function() {
if (arguments.length == 1) {
var valid = Ext.data.Api.isValid(arguments[0]);
if (valid === true) {
this.api = arguments[0];
}
else {
throw new Error('Ext.data.DataProxy#setApi received invalid API action(s) "' + valid.join(', ') + '". Valid API actions are: ' + Ext.data.Api.getVerbs().join(', '));
}
}
else if (arguments.length == 2) {
if (!Ext.data.Api.isVerb(arguments[0])) {
throw new Error('Ext.data.DataProxy#setApi received an invalid API action "' + arguments[0] + '". Valid API actions are: ' + Ext.data.Api.getVerbs().join(', '))
}
this.api[arguments[0]] = arguments[1];
}
Ext.data.Api.prepare(this.api, this.action);
},
load : function(params, reader, callback, scope, arg) {
this.doRequest(Ext.data.Api.READ, null, params, reader, callback, scope, arg);
}
});

Ext.override(Ext.data.HttpProxy, {
buildUrl : function(action, record) {
record = record || null;
var url = (this.api[action]) ? this.api[action]['url'] : this.url;
if (!url) {
throw new Ext.data.Api.Error('invalid-url', 'HttpProxy.js', url);
}
if (this.conn.prettyUrls === true && record instanceof Ext.data.Record && !record.phantom) {
url += '/' + record.id;
}
return url;
},
doRequest : function(action, rs, params, reader, cb, scope, arg) {
var method = (this.api[action]) ? this.api[action]['method'] : undefined;
var o = {
params : params || {},
method: method,
request: {
callback : cb,
scope : scope,
arg : arg
},
reader: reader,
callback : this.createCallback(action, rs),
scope: this
};
if(this.useAjax){
if (this.conn.url === null) {
this.conn.url = this.buildUrl(action, rs);
}
else if (this.conn.prettyUrls === true && rs instanceof Ext.data.Record && !rs.phantom) {
this.conn.url += '/' + rs.id;
}
Ext.applyIf(o, this.conn);
if (this.activeRequest[action]) {
Ext.Ajax.abort(this.activeRequest[action]);
}
this.activeRequest[action] = Ext.Ajax.request(o);
this.conn.url = null;
}else{
this.conn.request(o);
}
}
});

silcreval
9 May 2009, 1:50 PM
I've hit this problem too. I wasnt sure how to apply this patch. Just including
it in the code gave me an error

missing : after property id
prepare = function(api) {\n

I get the same problem (GET is used instead of POST).

Hope it can be solved soon....

overnoise
10 May 2009, 3:39 PM
me too for sure!

pcrombach
12 May 2009, 9:48 AM
Hoi Condor,

I understand that a send a patch can be not so easy. I will try tomorrow the overridecode. I guess you understand the best testers for a new RC are those with a heavy working app in ExtJS 2.1. Without working grids the testing here is on hold.

I am trying hard to find new customers for my app. Then I can afford another license.

Thank you for your support so far.

Christophe Gruau
21 May 2009, 11:48 AM
It's so strange this bug was not detected by developpers it's SO BIG :)
Congratulations for extjs 2, it's so stable and cross browser. Perfect, good job !
Just need good skin, theme and it's the ideal developpement tool.

pcrombach
22 May 2009, 2:50 PM
Hi, me too. I can't understand why this is not solved. Ok 3.0 is not a production release. But this way it is not fun to test in a real application. For all because they in the past called the grid a strategic part of the library. There are not much apps that dont use grids.

I stopped all testing on Extjs 3.0 untill there are more serious problems solved. I appriciate the Ex-team want to build in more features in the grid. But how could they overlook this bug. And for all why do they wait to release a bugrelease. Maybe the problems they introduces in the code are too big to solve. Allthough Condor replied the problems are know and solved. 1 More big reason to ask why not released in a patchrelease.

To Jack Slocum and his team. What is going on on this???
Please let the community know when the basic grid problems are solved. We are waiting.

silcreval
4 Jun 2009, 11:11 PM
Works fine in RC2 - thanks guys.

dbassett74
25 Jun 2009, 8:27 AM
Hmmm..I'm still seeing this in RC2. I just ran into it. How do you work around this?