Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread DataSet questions
Fri, May 3 2013 8:15 AMPermanent Link

Christian Kaufmann

1) I call Database.Load(...) in my FormShow event. It seems, that the
internal webbrowser is caching the data since my webserver only gets
one request until I close and restart EWB.
Is this default behaviour? Can I change this?
When I load my app in Chrome, I get a server request on each FormShow

2) Dynamic columns: I tried to send a request like this:

 { "columns": [ {}, {}, ...{} ],
   "rows": [ {}, {} ... ] }

It didn't work. Looking at the code in noticed that this is not
possible. Did already somebody write code to do this? The
TDatabase.Load code would be easy to update, but how to separate the
two data blocks in the Json response (columns and rows)

Or does somebody have a different approach to load table data with
dynamic columns?

cu Christian
Fri, May 3 2013 9:57 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Christian,

<< 1) I call Database.Load(...) in my FormShow event. It seems, that the
internal webbrowser is caching the data since my webserver only gets one
request until I close and restart EWB.
Is this default behaviour? Can I change this? >>

Yes, you have to have the back-end web server application tell the web
browser (IE) not to cache the content by using this header:

Cache-Control: no-cache

<< 2) Dynamic columns: I tried to send a request like this:

 { "columns": [ {}, {}, ...{} ],
   "rows": [ {}, {} ... ] }

It didn't work. Looking at the code in noticed that this is not possible.
Did already somebody write code to do this? The TDatabase.Load code would be
easy to update, but how to separate the two data blocks in the Json response
(columns and rows) >>

Why not just load the columns separately from the rows, as things are
designed ?  The TDataSet component has these two methods:

        procedure LoadColumns(const ColumnData: String);
        procedure LoadRows(const RowData: String;
                           Append: Boolean=False);

Tim Young
Elevate Software
www.elevatesoft.com
Mon, May 6 2013 9:50 AMPermanent Link

Christian Kaufmann

>Why not just load the columns separately from the rows, as things are
>designed ?  The TDataSet component has these two methods:
>
>         procedure LoadColumns(const ColumnData: String);
>         procedure LoadRows(const RowData: String;
>                            Append: Boolean=False);

Yes thanks. I wrote my own Database/Server class and read it like this
and it works fine.

However the JSON parser relies on the order and existence of the
key/value pairs. So I cannot use superobject in Delphi on the
serverside, because these classes give random order.

Some compiler magic arround Javascript objects would be nice:

type
 TJson = class (well not really)
   property AsInteger[AName: String]: Integer read write;
   property AsBoolean ...;
   property AsString;
   property AsArray;
 end;

var
 v : TJson;
begin
   v := TJson.Create('{ "title" : "Hello World!" }');
   ShowMessage(v.AsString['title']);

   should compile to:

   var v = JSON.parse('{ "title" : "Hello World!" }');
   ShowMessage(v.title);


Not sure, how complicate this is to realize that, but this would offer
great.

cu Christian
Tue, May 7 2013 4:39 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Christian,

<< However the JSON parser relies on the order and existence of the
key/value pairs. So I cannot use superobject in Delphi on the serverside,
because these classes give random order. >>

1.02 will have a JSON adapter for TDataset descendants in Delphi that will
generate the correct JSON for EWB.

<< Some compiler magic arround Javascript objects would be nice: >>

This is on the enhancement list already, but you've presented some good new
ideas on how to execute it.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Image