James --

Yes, it is possible to suppress change notifications.
See documentation for 'RecordSet.batch-events?' property.

The normal behavior of a RecordSet is to indicate every change
by firing a RecordSetEvent at itself.  Then, any consumer of the RecordSet
(like RecordGrid) knows to refresh itself, according to the change.

But when there are many changes, as in your example,
that causes many (unnecessary) refeshes of the display.

The RecordSet.batch-events? property allows applications
to control how change notifications are propagated.

When set to true, changes are accumulated, without notification,
and an appropriate RecordSetEvent (usually RecordBulkChanges) is
fired when batch-events? property is reset to false.

In your example, on my system, the 260 individual changes take about 1.4s.
Using batch-events? = true, they take just 0.03s

This is the change I made to your example.

               || show the hourglass while operating
               {with-busy-cursor
|| use batch notification to suppress individual change notification
                   {with list-rs1.batch-events? = true do
                       {for record in list-rs1 do
                           {record.set "flag", cb.value}
                       }
                   }
               }

Its recommended to use the 'with' syntax for this kind of change,
because that ensures that the value will always be reset (even after an exception).
If the value were not reset for some reason, then change notifications
would never be fired, and the display would never refresh.

Using 'with-busy-cursor' to show the hourglass is not necessary,
but I found it useful to be able to see when the system was working

Hope this helps

-- Doug

----- Original Message ----- From: "JamesWang" <[EMAIL PROTECTED]>
To: <curlbreaker-l@curl.com>
Sent: Monday, March 19, 2007 7:56 AM
Subject: Need a way to keep from calling "refresh-data""


Hello

Our developers have such question to ask.
Run the demo please. There are 260 rows and 12 columns datum in the
RecordGrid.
Clicking button will check or uncheck the last second column by the
checkbutton before it.
Our developers think this action takes more time than we can imagine.
After digging further, we found this problem was caused by "refresh-data".
If we changed one record data, "refresh-data" will be called thousands of
times.
We wonder if there is any way to keep from calling "refresh-data" when
changing the value of record.

Best regards.

James


----------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) is intended only for the use of the intended recipient and may be confidential and/or privileged of Neusoft Group Ltd., its subsidiaries and/or its affiliates. If any reader of this communication is not the intended recipient, unauthorized use, forwarding, printing, storing, disclosure or copying is strictly prohibited, and may be unlawful. If you have received this communication in error, please immediately notify the sender by return e-mail, and delete the original message and all copies from your system. Thank you.
-----------------------------------------------------------------------------------------------



Reply via email to