cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Larson <timlarsonw...@yahoo.com>
Subject Re: Fill woody repeater from flow
Date Fri, 24 Oct 2003 15:57:25 GMT
--- Timothy Larson <timlarsonwork@yahoo.com> wrote:
> I guess I still do not completely grasp JavaScript.
> It is easy enough from Java, but how would you
> populate a repeater from a flowscript?
> The context is I am trying to make a database query
> by example person search form.

Never mind.  Why do I figure things out right after I
break down and ask about them? For posterity here is one,
not necessarily efficient, way:

// Perform query and get results in ResultSet "result"
//   Left as exercise for the reader.

// Clear the repeater
while (0 in model.somewidget) { // While model.somewidget[0] exists
  delete model.somewidget[0];
}

// Populate the repeater
while(result.next()) {
  var field1 = result.getString("field1");
  var field2 = result.getString("field2");
  var max = model.people.length;
  var row = model.people[max]; // Magically creates a new row
  row.field1 = field1;
  row.field2 = field2;
}

--Tim Larson


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

Mime
View raw message