Re: [fpc-devel] Re: [fpc-pascal] fcl-web webdata example(s) on Windows has some problems

2010-08-18 Thread Michael Van Canneyt



On Tue, 17 Aug 2010, ABorka wrote:


did some more testing:

ROUND 4

1. minor note: We should not forget that field names are case sensitive in 
ExtJS, so any database field names need to be entered exactly:

ex:
 fields: ["id","login","name","email", "lastlogin"]
is not the same as
 fields: ["ID","LOGIN","NAME","EMAIL", "LASTLOGIN"]

or
 {header: 'ID', dataIndex: "id", sortable: true, hidden: true},
is not the same as
 {header: 'ID', dataIndex: "ID", sortable: true, hidden: true},

In the demo projects a DBF table is used with all capital letter field names. 
When I tried to use MySQL, it took me some time to realize this problem. 
Having zero errors displayed for this didn't help either :)


Yes. 
The case sensitivity of Javascript (and hence JSON) has given me grey

hairs prematurely :-)




2. major: It seems that the error/exception handling does not have the proper 
server responses for ExtJS (when read/insert/update/delete happens on the 
data), because with any exceptions there is nothing displayed but the empty 
grid with "no data to display" note.
Apparently, we need to append a '"rows" : ""' to our responses in order for 
ExtJS to properly accept our reply with the error message (being "rows" is 
our root element and ExtJS requires this):

ex: instead of
{ "success" : false, "message" : "Blahblah exception occured CGI side" }

it should be

'{ "success" : false, "message" : "Blahblah exception occured CGI side", 
"rows" : ""}


(not sure how using XML instead of JSON needs this done differently)
This needs to be done within our reply generation internally (fcl-web) when 
there is an error/exception or the message will never be displayed client 
side. Explanation:

In our *.js we have
data.addListener('exception', function(proxy, type, action, options, res) {
   if (type === 'remote') {
   Ext.Msg.show({
   title: 'REMOTE EXCEPTION',
   msg: res.message,
   icon: Ext.MessageBox.ERROR,
   buttons: Ext.Msg.OK
   });
   }
 });



This is ExtJS boilerplate code, with nothing FPC specific about it.

ExtJS however, will only have 'remote' type if the server response is proper 
for it (having a root /which is "rows"/ in our case), all other cases instead 
of 'remote' it has the type 'response', regardless of our "success" property 
being true or false.


Unfortunately, the ExtJS documentation is rather terse where this is
concerned.

So, if "rows" is not supplied, type='response' and the 'success' property must 
simply be checked ? Or do you suggest adding "rows" to the error response ?


I'm not sure if this is also the case if you are using a DirectStore ?

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Re: [fpc-pascal] fcl-web webdata example(s) on Windows has some problems

2010-08-17 Thread ABorka

did some more testing:

ROUND 4

1. minor note: We should not forget that field names are case sensitive 
in ExtJS, so any database field names need to be entered exactly:

ex:
  fields: ["id","login","name","email", "lastlogin"]
is not the same as
  fields: ["ID","LOGIN","NAME","EMAIL", "LASTLOGIN"]

or
  {header: 'ID', dataIndex: "id", sortable: true, hidden: true},
is not the same as
  {header: 'ID', dataIndex: "ID", sortable: true, hidden: true},

In the demo projects a DBF table is used with all capital letter field 
names. When I tried to use MySQL, it took me some time to realize this 
problem. Having zero errors displayed for this didn't help either :)



2. major: It seems that the error/exception handling does not have the 
proper server responses for ExtJS (when read/insert/update/delete 
happens on the data), because with any exceptions there is nothing 
displayed but the empty grid with "no data to display" note.
Apparently, we need to append a '"rows" : ""' to our responses in order 
for ExtJS to properly accept our reply with the error message (being 
"rows" is our root element and ExtJS requires this):

ex: instead of
{ "success" : false, "message" : "Blahblah exception occured CGI side" }

it should be

'{ "success" : false, "message" : "Blahblah exception occured CGI side", 
"rows" : ""}


(not sure how using XML instead of JSON needs this done differently)
This needs to be done within our reply generation internally (fcl-web) 
when there is an error/exception or the message will never be displayed 
client side. Explanation:

In our *.js we have
data.addListener('exception', function(proxy, type, action, options, res) {
if (type === 'remote') {
Ext.Msg.show({
title: 'REMOTE EXCEPTION',
msg: res.message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
  });

ExtJS however, will only have 'remote' type if the server response is 
proper for it (having a root /which is "rows"/ in our case), all other 
cases instead of 'remote' it has the type 'response', regardless of our 
"success" property being true or false.


AB

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel