We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Iterate through selected objects

Hi,

Until recently I have been using the following statement to iterate through selected objects:

        for (var i = 0; i < diagram.model.selectedItems.children.length; i++) {

It seems that this now yields 0 objects.

Am I now supposed to be using the newItems array which is passed as an argument to the OnClientSelectionChange handler?

I am currently using this only to determine the # of objects selected, including none (a requirement that I asked for earlier).

Please advise on how to proceed.

Thanks

Jim

1 Reply

SG Shyam G Syncfusion Team May 29, 2015 12:52 PM UTC

Hi Jim

Thanks for using Syncfusion products.

Please note that your approach is correct and you can use the newItems to get the selected object, which is passed as an argument to the OnClientSelectionChange handler. If we unselect the selected object, then the newItems will be empty and it will be added in the oldItems. Please note that by default selected Object will be added to the selectedItems, once the selection change event is completed and If we set an arg.cancel= true in the OnClientSelectionChange handler , then the selected object will not be added to the selectedItems. We have provided the drafted version of our documentation below for your references

Link:http://www.syncfusion.com/downloads/support/forum/119250/ze/Selection-403391422

Please let me know if any concerns.

Regards,
Shyam G

Loader.
Live Chat Icon For mobile
Up arrow icon