PDA

View Full Version : updateData fails on a Grid (?)


pcawdron
01-02-2007, 03:26 AM
How do you get the data in a grid to update the dataset source file?

I hate wasting people's time, so I've browsed the vast majority of the 55 odd forum entries on how to update a <grid> trying to figure this out. I also checked the contactlist, xmldata examples and calendar demo looking for something similar with a grid, but couldn't find anything.

There doesn't seem to be any examples that use the updateData() method described in chapter 35 paragraph 3.1 of the reference docs. I've tried it out as best I understand it, but it doesn't seem to work. Consider the following...

<canvas>
<dataset name="myDataset" request="true" src="data.xml"/>
<simplelayout axis="y" spacing="10"/>
<grid id="myGrid" datapath="myDataset:/mydata/structure" contentdatapath="sample"/>
<button onclick="myGrid.datapath.updateData();myGrid.datapath.seria lize();">Update Data</button>
</canvas>

data.xml
_______

<mydata>
<structure>
<sample counter="1" description="update this"/>
<sample counter="2" description="update that"/>
</structure>
</mydata>

You can view the dataset and make changes but they're not updated in the XML file.

Could anyone point me to some more literature on how this works?

Ideally, I'd prefer to send partial updates like...

<canvas>
<dataset name="myDataset" request="true" src="data.xml"/>
<simplelayout axis="y" spacing="10"/>
<grid id="myGrid" datapath="myDataset:/mydata/structure" contentdatapath="sample">
<gridtext datapath="@counter" onblur="this.datapath.updateData();">Counter</gridtext>
<gridtext datapath="@description" onblur="this.datapath.updateData();">Description</gridtext>
</grid>
</canvas>

Although that doesn't seem quite right either. I guess I'm after row updates which being low in volume and light in text content could be pushed back to the XML file rather than updating the entire file. Is that possible? Good idea or bad?

Any pointers welcome :)

As always, thanks for your help, it is appreciated.

Kind regards,
Peter

xiquach
01-14-2007, 11:28 PM
Please help us,
I have same question.
Please...........
Thanks

pcawdron
01-15-2007, 12:47 PM
xiquach,

There's no quick solution to this. OpenLaszlo is client side software and, as such, cannot directly update server-side resources. There has to be an intermediary, some server side component that receives a post from the client and the processes that.

So you can't go...

OpenLaszlo client -> MySQL database

You must go...

OpenLaszlo client -> middleware (jsp, php, xml) -> MySQL database

And the middleware, running on your server, manages security, hides code from prying eyes, all that sort of stuff.

I'm looking at using exist XML database as my middleware (hopefully without the need for a database at all). Check out...

http://forum.openlaszlo.org/showthread.php?t=1058

And you'll find some directions to help walk you through setting up a better server-side environment than the prepackaged servlet OL comes with.

I hope this helps,

Peter

d~l
01-15-2007, 01:48 PM
hopefully without the need for a database at all

Just a note to remind that there is another technique for reading/writing persistent data .. client side.

Search this forum for "Flash SharedObject". It is equivalent to a Flash cookie and (with user's permission) data can be saved locally.

It has its risks since these cookies can be easily erased by a user. But quite large datasets can be saved. Useful as an interim measure (e.g. whilst client is not connected to Internet) and then later updating a remote database server side.

_________________________________

p.s. ... I found the thread on SharedObject here. (http://forum.openlaszlo.org/showthread.php?t=7830&highlight=SharedObject)

_________________________________

egars
02-05-2007, 01:30 PM
Hi,

Currently, I'm tying Openlaszlo stuff to a JEE (formerly known as J2EE) backend though either webservices (very cumbersome & I'm not sure if I actually want SOAP) or just plain POST/GET and replies in XML by a servlet.

The webservice or servlet are coupled to a PostgreSQL database.

The calendar demo, does not work property at the moment, in either Laszlo versions 3.3.3, 3.0.2 or 4.0b1. I have tried using it from my own server, from the Openlaszlo site and from browsers running in Linux or Windows (including IE). Am I missing something?

If you press "add event" in the calendar, the dialog to add an event appears, The top three entry fields do not appear. They appear after button "delete" is pressed, and then the next time that "add event" is pressed the fields are there. If the <- and -> are pressed, an error message "NaN" or something appears.

The calendar demo is an important one (to me, that is, I was going to use it).

Onyone knows what is wrong?

Kind regards,

Egars

USA Mike
05-03-2007, 08:35 AM
hi !

+1, i need this update solution too, and even into the XML file or mysql database.

i'm READY TO PAY FOR THIS, with clear code and commented : 10€ . where is the paypal page to donate ?

someone else wants to donate with me ? it is communist time ! lol

pcawdron
05-03-2007, 03:44 PM
USA Mike.... the answer is for free...

http://forum.openlaszlo.org/showthread.php?t=8668

If you have a specific project you'd like this integrated with, you can paypal me to help, but if you work through these tutorials you'll find a fully functional XML interface working with a grid.

Cheers,
Peter

USA Mike
05-03-2007, 10:47 PM
thanks ? really you could ?

how many for a buton print option (in the day view mode ) of the calendar for a given DAY , and displaying only the events ?