Tables + displayCollection

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Tables + displayCollection

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:11 pm

by CassMan >> Wed, 19 Sep 2007 11:28:22 GMT

Hello,

I would like to use a table to display all instances within a collection, preferrably using a scroll bar as there may be as many as 100 entries. I am currently using the displayCollection method and this displays the first 26 entries (the maximum for the tables height), but does not allow the user to scroll, even though a scroll bar is present (It allows you to scroll by half a row to display the fixedRow too.

I have since been informed that this is because the displayCollection method only fills the table and discards any further entries. What should i use instead to allow all entries to be visible? Or, is there something i could change to do this but still using displayCollection?

Thank you in advance

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Tables + displayCollection

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:11 pm

by CassMan >> Wed, 19 Sep 2007 13:27:44 GMT

Thanks guys, but i have worked it out. due to the fact that displaycollection only displays until the table is full, i decided to create an iterator and fill the table rows one by one - an easy fix really. I really don't understand why displayCollection does not allow scrolling though. Odd.

Thanks anyway.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Tables + displayCollection

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:11 pm

by John Munro >> Wed, 19 Sep 2007 14:02:56 GMT

It does allow scrolling - we have tables with millions of rows in them, it should be able to do 100 in its sleep.

What was the displayCollection line you were using?

John

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Tables + displayCollection

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:11 pm

by CassMan >> Wed, 19 Sep 2007 15:49:59 GMT

I assumed it must do, otherwise there would be no point. But i just couldn't get it working.

The original line was:

table.displayCollection(myContributions, false, 0, null);

But i tried numerous different ones. There wasn't a problem before as the number of entries was always less than the table size, but due to a recent occurence i was asked to change it to allow more rows.

Rich

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Tables + displayCollection

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:11 pm

by John Munro >> Wed, 19 Sep 2007 16:15:03 GMT

That looks fine

Did you set the scrollBars property of the table to either Vertical or Both?

Another thing that could cause the Table to stop adding rows would be if you set the bcontinue parameter to false in your implementation of displayRow on the table.

On a completely separate note, if you have the update parameter of displayCollection set to false and the objects in the collection are updated by another user, your table won't update automatically. Depending on the situation this may not be important or you may have some other way of making sure it's not a problem, I just thought I'd point it out.

John

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Tables + displayCollection

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:11 pm

by Patwos >> Wed, 19 Sep 2007 21:11:28 GMT

"On a completely separate note, if you have the update parameter of displayCollection set to false and the objects in the collection are updated by another user, your table won't update automatically. Depending on the situation this may not be important or you may have some other way of making sure it's not a problem, I just thought I'd point it out."

Given that the most frequent use of displayCollection are from methods on a form, it is highly likely that the implied self for the myContributions collection is a form. If their code matches the most frequent usage of displayCollection, the collection in question is transient and he would therefore have to use false for the update parameter.

Hope that helps,
Pat.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Tables + displayCollection

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:11 pm

by cnwjhp1 >> Wed, 19 Sep 2007 21:43:11 GMT
Given that the most frequent use of displayCollection are from methods on a form, it is highly likely that the implied self for the myContributions collection is a form. If their code matches the most frequent usage of displayCollection, the collection in question is transient and he would therefore have to use false for the update parameter.

Or it could be a reference to a persistent collection, held on the form for convenience, perhaps to avoid coding app.myRoot.myOrganisation.myTeam.myContributions each time.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Tables + displayCollection

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:11 pm

by Allistar >> Wed, 19 Sep 2007 22:39:35 GMT

I always understood that it's not possible to hold a reference to an exclusive reference on another class (such as a form). To workaround this I'd implement a method on the form called something like "getCollection" which returns the long winded name. This saves nothing at runtime but may ease development if you refer to the collection a lot.
--
A.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Tables + displayCollection

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:11 pm

by dcooper@jade.co.nz >> Wed, 19 Sep 2007 23:37:56 GMT

Some people think this is a little morally questionable :-)

But you can hold the reference in a string property:

s := coll.getOidString;

And then get it back into a variable when you need it with:

coll := s.asOid.Collection;

Clearly you can cast to whatever type you need, so long as the string OID and the variable's type are compatible.

Dean.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Tables + displayCollection

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:11 pm

by Allistar >> Thu, 20 Sep 2007 1:57:24 GMT

Another, equally morally questionable way of doing this is to define an iterator on the form and attach it to the collection in the load of the form like this:

myIterator := coll.createIterator();

then in your code you could call

coll := myIterator.getCollection();

just remember to delete the iterator when the form is deleted.

Ick.

Allistar.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 28 guests

cron