[fpc-devel] Re: [fpc-pascal] fcl-web webdata example(s) on Windows has some problems
ABorka
fpc-devel at aborka.com
Wed Aug 18 07:38:46 CEST 2010
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
More information about the fpc-devel
mailing list