[Pas2js] TJSIDBObjectStore.add() not working with a recordtype variable.....
Pedro Pablo Oviedo Vera
verakuba13 at gmail.com
Wed Oct 2 17:32:21 CEST 2019
Yes, you all right!...I am try it ....my problem :
...for example...I declare >>>>>
type
gsolicitud : TJSIDBOpenDBRequest;
gMyDB : TIDBDatabase;
function fOpenDB(aEvent: TEventlistenerEvent): Boolean;
begin
(* inside event handler I need get params retorned from request *)
gMyDB := aEvent.target; <==== but this does not works for me
gMyDB := gsolicitud.resultAsDatabase; <==== so I must try this !!! :-( but
it is not correct!
end;
begin
......
gsolicitud := Window.indexedDB.open(gDBName,4); <<<< I requesting for
this event
gsolicitud.onsuccess := @fOpenDB; <<< and set
this function to handles this event
......
end;
When I go to the event handler function I try get params returned through
aEvent.target ( gMyDB := aEvent.target; ) but compiler tells type
missmacthed!, then I just try solve it do some thing like this ( gMyDB :=
gsolicitud.resultAsDatabase; )....it is not just in this case ...it happend
to me always that I need recover a param inside of an event handler
function...so if some one has an answer about it please illustrate
me..THANKS
El sáb., 21 sept. 2019 a las 12:17, Michael Van Canneyt (<
michael at freepascal.org>) escribió:
>
>
> On Fri, 20 Sep 2019, Pedro Pablo Oviedo Vera wrote:
>
> > Hello people!,
> > Im facing this problem:
> >
> > var
> > fTransPeliculas: TJSIDBTransaction;
> > fTransAlmacen : TJSIDBObjectStore;
> > fSolicitud : TJSIDBRequest;
> > begin
> >
> > (......)
> >
> > fTransPeliculas := gMyDB.transaction(['peliculas'],'readwrite');
> > fTransAlmacen := fTransPeliculas.objectStore('peliculas');
> >
> > gInfo.clave := gedtClave.value;
> > gInfo.anno := gedtFecha.value;
> > gInfo.texto := gedtTexto.value;
> >
> > fSolicitud := fTransAlmacen.add(gInfo,'clave');
> >
> > but from browser consola I recieve the message:
> > DataError: Data provided to an operation does not meet
> requirements.
> >
> > but when use this alternative....
> > asm
> > fSolicitud =
> >
> fTransAlmacen.add({id:$mod.gInfo.clave,nombre:$mod.gInfo.texto,fecha:$mod.gInfo.anno});
> > end;
> >
> > everything works!!!!
> > perhaps fSolicitud := fTransAlmacen.add(gInfo,'clave'); is
> > incorrepts ...then how it will be OK?
>
> first of all, you are doing things very differently
> - your asm code does not provide a key, your pascal code does.
> - the structure of the object you are saving is very different.
>
> Secondly, to know why it goes wrong, we need to know what is the
> definition of the
> object store.
>
> Maybe this answers your question:
>
> https://stackoverflow.com/questions/36016862/indexeddb-dataerror-data-provided-to-an-operation-does-not-meet-requirements
>
> Michael.
> _______________________________________________
> Pas2js maillist - Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
>
--
MSc. Ing. Pedro Pablo Oviedo Vera
Dirección Técnica y Desarrollo
Empresa de Proyectos e Ingeniería del
Ministerio de la Agricultura.ENPA.
Boyeros y Conill, Piso 10 Edif MINAG
Telef. 884 7197
SIP:23000116
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20191002/7d9d9060/attachment.html>
More information about the Pas2js
mailing list