client doesn't show data lazarus / 76-Pas2JS ---------------------------------------------------------------------- mangakissa · 2020-06-29 14:31 With this link I build a very basic restserver with time. The server is located on localhost:9080. With my browser I get a result without problems. Now I built with pas2js a simple page with one button and a dataset. If I run the restserver in debug mode I can see the clinet is doing a request. The response is sent back to the client. But the client is doing nothing. I put an writeln in procedure DSOpen() but the writeln will not displaying in browser. The doGetUrl() and btnTimeClick() are displaying well. Why will my dataset not open and display data in my browser? ---------------------------------------------------------------------- ps · 2020-06-29 18:33 It's client and server on same domain? ---------------------------------------------------------------------- TRon · 2020-06-30 04:40 Hi mangakissa, Thank you for your example. I am completely oblivious with regards to pas2js so I have no idea what I am doing (other then following wiki pages and forum posts). I added some output messages to the server, then fired it up. Then I loaded your html page, which loads your script generated by pas2js. That showed me a button. When I pressed that the server showed: Code: [Select]2020.06.30 07:27:04:315 : Server: default routing from time 2020.06.30 07:27:04:317 : Server: Send json response Which are my output messages. The browser window (chromium) showed me: Code: [Select]button clicked URL :http://localhost:9080/time loaded..... The browser console showed me: Code: [Select]button clicked client.js:12458 URL :http://localhost:9080/time client.js:12458 loaded..... client.html:1 Access to XMLHttpRequest at 'http://localhost:9080/time' from origin 'null' has been blocked by CORS policy: No 'Access- Control-Allow-Origin' header is present on the requested resource. And... that is as far as I was able to comprehend, other than the hint to add a header ? ---------------------------------------------------------------------- PascalDragon · 2020-06-30 07:27 Quote from: TRon on June 30, 2020, 06:40:49 amThe browser console showed me: Code: [Select]button clicked client.js:12458 URL :http://localhost:9080/time client.js:12458 loaded..... client.html:1 Access to XMLHttpRequest at 'http://localhost:9080/time' from origin 'null' has been blocked by CORS policy: No 'Access- Control-Allow-Origin' header is present on the requested resource. And... that is as far as I was able to comprehend, other than the hint to add a header ? The missing CORS header is exactly the problem. You either need to set that header correctly (though I don't know right now how it needs to be set for a local file...) or you need to distribute the HTML file and JS script using the restserver as well. I'd suggest the later. If you use FPC 3.2.0 you can do this rather easily like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i // add unit fpWebFile to your uses clause of the server project begin  Application.Port := 9080;  HTTPRouter.RegisterRoute('/time', @timeEndpoint, true);  HTTPRouter.RegisterRoute('/greeting/:name', @greetingEndpoint);  // here you need to use the bath to the client data relative to your executable  TSimpleFileModule.BaseDir := ExpandFileName('../client');  // you need a file with mime types, though I *think*  // that FPC 3.2.0 can also do this without  // you'll notice if it works or not if your browser tries to  // download the HTML file instead of displaying it ;)  MimeTypesFile := ExpandFileName('./mime.types');  // pick some route where you want your webserver to serve the  // files from  HTTPRouter.RegisterRoute('/client/*', @TSimpleFileModule.HandleSimpleFileRequest);  Application.Threaded := true;  Application.Initialize;  Application.Run;end. ---------------------------------------------------------------------- TRon · 2020-06-30 09:31 Thank you PascalDragon. Unfortunately that seems to complicate matters even more for me .... (do note that i'm easily confused :-) ) I have server and client both located in the same directory so i used: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  ...  TSimpleFileModule.Basedir := ExpandFileName('./client');  // mimetypes ...needed for 3.2 ?  MimeTypesFile := ExpandFileName('./mime.types'); // pick some route where you want the server to serve the files from  HTTPRouter.RegisterRoute('./*', @TSimpleFileModule.HandleSimpleFileRequest);... html/js response from client is identical as mentioned before, however the console does reply in a different manner: Code: [Select]client.js:12458 button clicked client.js:12458 URL :http://localhost:9080/time client.js:12458 loaded..... client.js:12331 GET http://localhost:9080/time net::ERR_CONNECTION_REFUSED The result from using another route for the filerequest (which i tried first, using previous pasted mimetype and client location): Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ..  HTTPRouter.RegisterRoute('*', @TSimpleFileModule.HandleSimpleFileRequest);.. resulted in a console output of: Code: [Select]button clicked client.js:12458 URL :http://localhost:9080/time client.js:12458 loaded..... client.html:1 Access to XMLHttpRequest at 'http://localhost:9080/time' from origin 'null' has been blocked by CORS policy: No 'Access- Control-Allow-Origin' header is present on the requested resource. client.js:12331 Cross-Origin Read Blocking (CORB) blocked cross-origin response http://localhost:9080/time with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details. I do not even have an idea of what is the correct routing there..... the last seems more promising, but at the same time seems more wrong to me.... I even tried "/*" but that seems to act in the same manner as the results in my first post. The only difference to that is that after so many repeated (click button) retries it adds the additional message "Cross-Origin Read Blocking (CORB) blocked cross-origin response http://localhost:9080/time with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details." I did had a read about that CORB blocking, and an answer from SO seems to suggest installing an extension/plugin (yet another one) to circumvent this blocking issue, but i'm not that stupid as it should just simply be a matter of proper configuration. ---------------------------------------------------------------------- mangakissa · 2020-06-30 12:25 QuoteUnfortunately that seems to complicate matters even more for me .... (do note that i'm easily confused :-) ) But I am. It's all about streaming, isn't it? The expanded code above does give met this message: Quote[Debugger Exception Notification] Project project1 raised exception class 'EHTTP' with message: No REQUEST_METHOD passed from server.  At address 100027DC2 [Ignore this exception type] I have disabled CORRS on firefox. I'm using Lazarus 2.1.0 / FPC 3.20 on using pas2js ---------------------------------------------------------------------- PascalDragon · 2020-06-30 13:13 Quote from: TRon on June 30, 2020, 11:31:55 am Thank you PascalDragon. Unfortunately that seems to complicate matters even more for me .... (do note that i'm easily confused :-) ) I have server and client both located in the same directory so i used: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  ...  TSimpleFileModule.Basedir := ExpandFileName('./client');  // mimetypes ...needed for 3.2 ?  MimeTypesFile := ExpandFileName('./mime.types'); // pick some route where you want the server to serve the files from  HTTPRouter.RegisterRoute('./*', @TSimpleFileModule.HandleSimpleFileRequest);...  I've now checked the provided example myself (the other code was from my own project). I have not tested to put the HTML and JS file into the same directory as the server however. The following works if the server directory is next to the client directory: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin  Application.Port := 9080;  HTTPRouter.RegisterRoute('/time', @timeEndpoint, true);  HTTPRouter.RegisterRoute('/greeting/:name', @greetingEndpoint);  TSimpleFileModule.BaseDir := ExpandFileName('../');  MimeTypesFile := 'mime.types';  HTTPRouter.RegisterRoute('/client/*', @TSimpleFileModule.HandleSimpleFileRequest);  Application.Threaded := true;  Application.Initialize;  Application.Run;end. There won't be a CORS error this way as long as you call the HTML site using localhost. If you want to publish this on a different computer (even if it's the same LAN) then you need to make sure that your Pas2JS code does not load from localhost, but maybe preferred using just the URI instead: /time instead of http://localhost/time. Alternatively you'll need to make sure that the server is set correctly (in what way ever). The only error I now get is that the JSON DB parser can't find any fields. ---------------------------------------------------------------------- TRon · 2020-06-30 20:08 Thank you PascalDragon. Unfortunately i couldn't get it to work as seem intended. So, i ended up manipulating the response header manually. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   res.SetFieldByName('Access-Control-Allow-Origin', '*'); which resulted in the browser with: Code: [Select]button clicked URL :http://localhost:9080/time loaded..... DoAfterLoad ..and the console with: Code: [Select]button clicked client.js:12458 URL :http://localhost:9080/time client.js:12458 loaded..... client.js:12458 DoAfterLoad client.js:11797 Uncaught details: Code: [Select]__proto__: $ancestor: {$ancestor: {…}, $class: {…}, $classname: "EDatabaseError", $parent: {…}, $module: {…}, …} $class: {$ancestor: {…}, $class: {…}, $classname: "EJSONDataset", $parent: {…}, $module: {…}, …} $classname: "EJSONDataset" $fullname: "JSONDataset.EJSONDataset" $module: {$name: "JSONDataset", $intfuseslist: Array(8), $impluseslist: Array(1), $state: 5, $intfcode: ƒ, …} $name: "EJSONDataset" $parent: {$name: "JSONDataset", $intfuseslist: Array(8), $impluseslist: Array(1), $state: 5, $intfcode: ƒ, …} $rtti: {name: "EJSONDataset", $module: {…}, class: {…}, members: {…}, names: Array(0), …} __proto__: Object With details on the uncaught Code: [Select]InternalInitFieldDefs @ client.js:11797 InternalOpen @ client.js:11746 InternalOpen @ client.js:12048 DoInternalOpen @ client.js:6481 OpenCursor @ client.js:6949 SetActive @ client.js:6982 Open @ client.js:7450 HandleRequestresponse @ client.js:6577 cb @ client.js:217 DoAfterRequest @ client.js:7785 onLoad @ client.js:12371 cb @ client.js:217 load (async) DoGetData @ client.js:12315 DoLoad @ client.js:6601 Load @ client.js:7371 btnTimeClick @ client.js:12526 cb @ client.js:217 FPC 3.2.0, Raspbian Linux arm (in case that is useful for mangakissa) ---------------------------------------------------------------------- PascalDragon · 2020-07-01 07:29 Quote from: TRon on June 30, 2020, 10:08:26 pmUnfortunately i couldn't get it to work as seem intended. So, i ended up manipulating the response header manually. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   res.SetFieldByName('Access-Control-Allow-Origin', '*');  You should really try to find out why it's necessary for you, cause setting a general CORS header (one with an asterisk instead of specific domains) is a bad idea (TM) - at least if one intends to publish the server on the web. ---------------------------------------------------------------------- TRon · 2020-07-01 08:47 Quote from: PascalDragon on July 01, 2020, 09:29:13 amYou should really try to find out why it's necessary for you, cause setting a general CORS header (one with an asterisk instead of specific domains) is a bad idea (TM) - at least if one intends to publish the server on the web. Sorry, I keep forgetting we're on a public forum....  Yes, i need to figure out the why and yes it is a bad idea. Before I did resort to using the asterisk, I did read the answers from this SO question: https://stackoverflow.com/questions/10636611/how- does-access-control-allow-origin-header-work Which explains how the header works, what you should use for this header (in case you do use it) and explains (or links to) the risks/pitfalls involved. My main focus was to get at the point where user mangakissa apparently already is, in order to try to understand what is going wrong. I'm trying as hard as I possibly can to catch up on this whole js thing, and got a little stuck on the jsondataset. There seems to be no documentation ? and going through the sources goes slow because everything seems to go back'n'forth and forth'n'back again (multiple times)  I do apologise in case i'm sort of derailing mangakissa's thread. Initially I had the impression he had/has similar issues that I encountered in this thread. edit: judging by the restserver example the server from mangakissa does not appear to send (all) the required data that a jsondataset seem to expect, such as f.e. metadata header ---------------------------------------------------------------------- mangakissa · 2020-07-01 11:20 But in my example to asking time there's no metadata. It just calls a procedure to create an json response sent sent it back to client. Why to I get data if I put 'http://localhost:9080/time' in my browser? Is it sending hidden data to call the restserver? ---------------------------------------------------------------------- TRon · 2020-07-01 11:30 Quote from: mangakissa on July 01, 2020, 01:20:20 pmBut in my example to asking time there's no metadata. It just calls a procedure to create an json response sent sent it back to client. Yes, but as far as i am able to tell that is exactly what is the issue. You open a jsondataset (RestDataSet) on the resulting string. As such the client expects to receive the proper data (information). QuoteWhy to I get data if I put 'http://localhost:9080/time' in my browser? Is it sending hidden data to call the restserver? For the dataset to work you need to follow a certain pattern, just as you would do for a normal dataset. A normal dataset (let's call it table) has filednames definitions and then rows of data that fill that database. Using the TRestdataset requires something similar, at least that is what my tests are showing. What i have now is that the server sends back: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {  "metaData" : {    "fields" : [      {        "name" : "time",        "type" : "string"      }    ],    "root" : "Data"  },  "Data" : [    {      "time" : "13:21:57"    }  ]} And the browser (client) responds to that with: Code: [Select]button clicked URL :http://localhost:9080/time loaded..... DoAfterLoad Dataset opened 1 -13:21:57 URL :http://localhost:9080/time Which seems to be what you are attempting to accomplish ? If that is not the case then we need to have a conversation on what it is that you are exactly expecting or are trying to accomplish edit PS: do note that I have less then 24 hours experience with pas2js, so in case my writings are incorrect then please correct me. edit2: and I have no idea why but it seems each time my server receives two GET requests (and responds to them as well) ---------------------------------------------------------------------- mangakissa · 2020-07-01 12:56 Yes, that's correct. But this response must be created manually. I did this in my other topic. But I got stuck with no response. So I looked to on the forum and found a link: how to create a simple restserver. My actual project calls a complete list by pressing the search button. Build the testserver with the required (header) fields. I see then coming as a log in my restserver, but when the response must sent back a streamwrite error occurs. And I can't figure it out why. (I looked for two weeks now, but al time together about one day all) ---------------------------------------------------------------------- TRon · 2020-07-01 13:31 Quote from: mangakissa on July 01, 2020, 02:56:45 pmI did this in my other topic. But I got stuck with no response. Sorry, I have no idea you already started a topic about this... topic  QuoteMy actual project calls a complete list by pressing the search button. Build the testserver with the required (header) fields. I see then coming as a log in my restserver, but when the response must sent back a streamwrite error occurs. And I can't figure it out why. I have no idea why (yet) but this is what my chromium browser returns in the console: Code: [Select]Uncaught fMessage: "Field definition 9 in has no or invalid name property" Also, not sure if it should happen before or after that exception but the search field wasn't mentioned by server, and i seems also to be missing the content of my search query. Perhaps you have an idea about the fieldname ?. I will look through the code and see if I am able to track that down but I do not have many time left for today. ---------------------------------------------------------------------- TRon · 2020-07-01 14:03 Quote from: TRon on July 01, 2020, 03:31:56 pmI have no idea why (yet) but this is what my chromium browser returns in the console: Code: [Select]Uncaught fMessage: "Field definition 9 in has no or invalid name property" Perhaps you have an idea about the fieldname ?. I will look through the code and see if I am able to track that down but I do not have many time left for today. Got it, I think  Inside restdata.pp, line 58 (here 11 highlighted): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     MetaData.Arrays['fields'].Add(TJSONObject.Create(    ['supplier',    'product',    'type',    'size',    'reference',    'package',    'quantity',     'pkquantity',     'location',     'int'])); I was thrown off by the error message only mentioning "in', and not "int" I have not been able to test further yet. edit: ok, I can see you got your queue from the demo and I noticed on the first testruns (scroll down to highlighted): Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {  "metaData" : {    "fields" : [      {        "name" : "supplier",      "type" : "string"      },      {        "name" : "product",        "type" : "string"      },      {        "name" : "type",        "type" : "string"      },      {        "name" : "size",        "type" : "string"      },      {        "name" : "reference",        "type" : "string"      },      {        "name" : "package",        "type" : "string"      },      {        "name" : "quantity",        "type" : "int"      },      {        "name" : "pkquantity",        "type" : "string"      },      {        "name" : "location",        "type" : "string"      },      {        "supplier" : "product",        "type" : "size",        "reference" : "package",        "quantity" : "pkquantity",        "location" : "int"      }    ],    "root" : "Data"  },  "Data" :  Which currently doesn't make any sense to me. Why is it there, inside the JSON (metadata) and as a field-def ? When I removed the int, I got an exception (missing pair value): Code: [Select]An unhandled exception occurred at $000D7558: EJSON: TJSONObject must be constructed with name,value pairs   $000D7558  TJSONDATA__DOERROR,  line 1382 of ./fcl- json/src/fpjson.pp   $000DBF28  TJSONOBJECT__CREATE,  line 3200 of ./fcl- json/src/fpjson.pp   $0007C0C4  LOADRESTDATA,  line 57 of restdata.pp   $0007D0DC  RESTDATA_$$_init$,  line 239 of restdata.pp   $00032E70  fpc_initializeunits,  line 969 of /home/Pierre/pas/release-build/release_3_2_0/fpcsrc/rtl/inc/system.in which makes sense as fielddefs come in pairs, and those do not look like field-definitions to me. Unless I'm missing something that I am not aware off with regards to TRestDataSet, otherwise this seems to be your (current) issue. edit2: in the restserver example, it seems that the original (stored on disk) data is extended (before sending to the client) with an extra field with the name "id" of type "int". That is why the restserver example seems to be 'fixing' all the data by adding an id field using the following loop: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     MetaDat a.Arrays['fields'].Add(TJSONObject.Create(['name','id','type','int'])) ;    For I:=0 to Data.Count-1 do      Data.Objects[i].Add('id',I+1);  LastID:=Data.Count; .. which makes sense if you actually make use of such an id. However as you can see from your own code, you seem to be doing (or wanting) something else there ? ---------------------------------------------------------------------- TRon · 2020-07-01 15:12 OK, i reinstated the id created as intended. JSon data now looking good Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Procedure LoadRestData;Var  F : TFileStream; D : TJSONData; I : Integer;begin  F:=TFileStream.Create('fust.json',fmOpenRead or fmShareDenyWrite);  try    D:=GetJSON(F);    if not (D is TJSONObject)       then D.Free  else Packet:=D as TJSONObject;    // add new field "id" for referencing individual rows    MetaData.Arrays['fields'].Add(TJSONObje ct.Create(['name','id','type','int']));    // 'fix' the (original json) data to include a new field named "id", and give it a (unique) number    For I:=0 to Data.Count-1 do      Data.Objects[i].Add('id',I+1);    LastID:=Data.Count;      finally    F.Free;  end;end;  Then the console thows us a: Code: [Select]myclient1.js:12607 Uncaught TypeError: Cannot read property 'append' of null at Object.DSOpen (myclient1.js:12607) at Object.cb [as FAfterOpen] (myclient1.js:217) at Object.DoAfterOpen (myclient1.js:6823) at Object.OpenCursorcomplete (myclient1.js:6946) at Object.SetActive (myclient1.js:6973) at Object.Open (myclient1.js:7439) at Object.HandleRequestresponse (myclient1.js:6571) at Object.cb [as FAfterRequest] (myclient1.js:217) at Object.DoAfterRequest (myclient1.js:7774) at Object.onLoad (myclient1.js:12353) That's enough for me today ---------------------------------------------------------------------- mangakissa · 2020-07-02 13:05 Thank you very very very much, TRon. I have finally results on screen. The problem is documentation. Offcourse you can learn a lot of examples, but comments are very usefull why this is happening. Quote in the restserver example, it seems that the original (stored on disk) data is extended (before sending to the client) with an extra field with the name "id" of type "int". That is why the restserver example seems to be 'fixing' all the data by adding an id field using the following loop..... I looked in the original file and saw this line Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i MetaData.Ar rays['fields'].Add(TJSONObject.Create(['name','id','type','int'])); as the same fielddefs in countries.json. That's why I tought the same meta fields in my json file must be exactly. That is the reason I changed it. There was no doc to tell that it should always be as the above code line. I Put the lines of pascaldragon into the restserver to tell the CORS that the streaming is valid. But still no results. You option to set the header Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i res.SetFieldByName('Access-Control-Allow-Origin', '*'); is for this moment the only way to get result. Hopefully there's a 'clean' way to do it otherwise. ---------------------------------------------------------------------- TRon · 2020-07-02 14:09 Quote from: mangakissa on July 02, 2020, 03:05:44 pmThank you very very very much, TRon. You are more than welcome mangakissa. I had/have fun with learning about a fpc topic that i've never touched before. QuoteI have finally results on screen. Cool. Congratulations ... and I have so many questions  For example do you filter the data on the server or on the client ? From your code that I've seen so far it was not clear to me what you exactly intended to do there. QuoteThe problem is documentation. Offcourse you can learn a lot of examples, but comments are very usefull why this is happening. Yes, I agree. Having an example is one thing but figuring out how all these new classes work is daunting enough let alone example-code that seems to do something out of the ordinary. At least a small comment about what or why it was done could have been of tremendous help there. Of course, in hindsight, it is now obvious (as is usually the case with these kind of things)  QuoteHopefully there's a 'clean' way to do it otherwise. Yeah, I tried to delve into that subject today but so far and unfortunately turned up empty :-( Even though you already know, I do again emphasis on the risks involved using that header. Do not use that for production, and in case you must then restrict it to domains you are able to trust. Will you be doing an article on this subject as well (not trying to force your hand there) ? afaik there is not an example that uses search queries on a json rest dataset, therefore I would be interested. Some of this stuff is still going a bit over my head I'm afraid. ---------------------------------------------------------------------- mangakissa · 2020-07-02 15:03 QuoteCool. Congratulations ... and I have so many questions  For example do you filter the data on the server or on the client ? From your code that I've seen so far it was not clear to me what you exactly intended to do there.It's a list with how many packages and which packages a supplier need to fill flowerbulbs in. The real data is a spreadsheet. But spreadsheets are nog multiple users. the second user is read only. If the 'main' colleague want to change it hwen another colleague has opened it, changes can not be made. In Lazarus I built an application that reads the spreadsheet once. With selections I can filter the data. Every time I open that application, new data is read. Also an button can refresh the data. It could also works with a webbrowser and javascript. That's why I try to use pas2js. Filtering must be done by server. The client must be a stupid client. Only show data when it is requested. I want the client run on a smartphone. QuoteWill you be doing an article on this subject as well ? afaik there is not an example that uses search queries on a json rest dataset, therefore I would be interested. Some of this stuff is still going a bit over my head I'm afraid.i always do that with these projects ---------------------------------------------------------------------- TRon · 2020-07-02 17:05 Thank you for the explanation of your project mangakissa, sounds interesting. Quote from: mangakissa on July 02, 2020, 05:03:09 pmFiltering must be done by server. The client must be a stupid client. Only show data when it is requested. I want the client run on a smartphone. Ok, I suspected as such (and it made the most logical sense). Client runs on a smartphone ? Does that mean you are able to use the pas2js generated code in (what I assume) Android directly ? Nice if you are able to cook up some article on your findings with regards to pas2js and using json rest db. I'll be looking forward to it, I thank you in advance. ---------------------------------------------------------------------- mangakissa · 2020-07-02 17:55 QuoteClient runs on a smartphone ? Does that mean you are able to use the pas2js generated code in (what I assume) Android directly ?No. Just using the browser calling a webadress ---------------------------------------------------------------------- TRon · 2020-07-02 21:52 @mangakissa: uhm, of course  That's a facepalm for me ---------------------------------------------------------------------- PascalDragon · 2020-07-03 07:12 Quote from: TRon on July 02, 2020, 11:52:24 pm@mangakissa: uhm, of course  That's a facepalm for me Though one can also host the code in an app that allows the running of JS code (for example Apache Cordova). ---------------------------------------------------------------------- mangakissa · 2020-07-15 13:19 Small update. Close the dataset after loading / showing data. If it's still open, data will not refresh.