collectionChanged Event

Summary

Occurs when an item is added, removed, changed, moved, or the entire list is refreshed.

Syntax

JavaScript Syntax
Object.defineProperty(LeadCollection.prototype,'collectionChanged', 
	get: function(), 
	set: function(value) 
) 
function collectionChanged.add(function(sender, e)); 
function collectionChanged.remove(function(sender, e)); 
TypeScript Syntax
collectionChanged: void; 

Event Data
ParameterTypeDescription
sendervarThe source of the event.
e NotifyLeadCollectionChangedEventArgs The event data.
Remarks

See NotifyLeadCollectionChangedEventArgs for more information on the content of changes.

When checking for changes in CollectionChanged, it is better practice to check the values of NotifyLeadCollectionChangedEventArgs.OldItems and NotifyLeadCollectionChangedEventArgs.NewItems than NotifyLeadCollectionChangedEventArgs.Action, to prevent cases where a NotifyLeadCollectionChangedAction case is missed or incorrectly handled. See below for an example:

` 
function collectionChanged(sender, args) { 
 
   // Optionally, surround the code below in an if-statement like: 
   //    if (args.action !== lt.NotifyLeadCollectionChangedAction.move) { ... } 
   // since sometimes we don't need to do anything if the item is removed 
   // and then added back in a different spot. 
 
   // Check for removed items first to do some clean-up 
   if (args.oldItems.length > 0) { 
      // Do some setup, if necessary... 
 
      // Loop and do work 
      for (var i = 0; i < args.oldItems.length; i++) { 
         doRemovedItem(args.oldItems[i]); 
      } 
   } 
 
   // Now check for added items 
   if (args.newItems.length > 0) { 
      // Do some setup, if necessary... 
 
      // Loop and do work 
      for (var i = 0; i < args.newItems.length; i++) { 
         doAddedItem(args.newItems[i]); 
      } 
   } 
} 
`

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly