Hi all,
It seems, that feed.size() doen't work properly. In the first call
it delivers alway 0, In the seconc call the real value. This is a
strange behaviour, isnt it.
attached you will find sample coding
=> bug!
keep the spirit of GME alive...
Jan
<gm:page title="My App" authenticate="true" onload="onLoad()>
<gm:data id="pd" data="${user}/huhu"/>
<gm:list id="personalData" data="${pd}" template="Detailbild" pagesize
= "99"/>
<gm:template id="Detailbild">
<table>
<tr repeat="true">
<td> Zeitraum von: </td>
<td> <gm:date ref="gd:from"/> </td>
<td> bis: </td>
<td> <gm:date ref="gd:to"/> </td>
<td> <gm:number ref="gd:counter"/> </td>
<td><gm:editButtons editonly="false"/></td>
</tr>
</table>
</gm:template>
<script>
function onLoad(){
var fromGPath = new GPath("gd:from");
var toGPath = new GPath("gd:to");
//Get the Feed
var myData = google.mashups.getObjectById( 'personalData' );
feed = myData.getData();
// fist alert returns always 0...
alert(feed.size());
// second alert returns the real size...
alert(feed.size());
if(feed.size()< 2) {
//Create a new entry
var entry = feed.createEntry();
//Set the values
fromGPath.setValue(entry,'2001-12-12');
toGPath.setValue(entry,'2004-01-01');
//Add the entry to the feed
feed.addEntry(entry);
}
}
</script>
</gm:page>