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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to determine # of objects selected

Thread ID:





118593 Mar 22,2015 04:51 PM UTC Mar 23,2015 11:29 AM UTC ASP.NET Web Forms 1
Tags: Diagram
Jim Jacobs
Asked On March 22, 2015 04:51 PM UTC


I need to know if:
  • 1 object is selected
  • >1 object is selected
  • No objects are selected

I am using the following in several functions within my app, and it seems to be working fine:


However, when I use this in the OnClientSelectionChange event handler, I get strange results.

Watch the attached video, which shows (in the console log) the results I'm getting.

Here's the event handler:

function selectionChangeHandler(args) {
                console.log('In selectionChangeHandler - # objects selected = ' + diagram.model.selectedItems.children.length);
                var objectName = null;
                if (args.element.name) {
                    objectName = args.element.name;
                if (objectName && objectName.substring(0, 9) != 'connector' && objectName.substring(0, 6) != 'bezier' && objectName.substring(0, 5) != 'Horiz' && objectName.substring(0, 8) != 'Vertical') {
                    var handles = diagram.model.selectedItems.userHandles;
                    handles[0].visible = true;
                } else {
                    var handles = diagram.model.selectedItems.userHandles;
                    handles[0].visible = false;
                var node = args.element;
                if (node) {
                    if (node.addInfo) {
                        if (node.addInfo.NodeType) {
                            if (node.addInfo.NodeType == 'Task') {
                                document.getElementById('<%= lblRoleCount.ClientID %>').innerHTML = 0;
                                document.getElementById('<%= lblInputCount.ClientID %>').innerHTML = 0;
                                document.getElementById('<%= lblOutputCount.ClientID %>').innerHTML = 0;
                                document.getElementById('<%= lblDataCount.ClientID %>').innerHTML = 0;
                                document.getElementById('<%= lblToolCount.ClientID %>').innerHTML = 0;
                                document.getElementById('<%= lblProcCount.ClientID %>').innerHTML = 0;
                                document.getElementById('<%= lblNoteCount.ClientID %>').innerHTML = 0;

                                if (node.addInfo.roleCount) {
                                    document.getElementById('<%= lblRoleCount.ClientID %>').innerHTML = node.addInfo.roleCount;
                                if (node.addInfo.inputCount) {
                                    document.getElementById('<%= lblInputCount.ClientID %>').innerHTML = node.addInfo.inputCount;
                                if (node.addInfo.outputCount) {
                                    document.getElementById('<%= lblOutputCount.ClientID %>').innerHTML = node.addInfo.outputCount;
                                if (node.addInfo.dataCount) {
                                    document.getElementById('<%= lblDataCount.ClientID %>').innerHTML = node.addInfo.dataCount;
                                if (node.addInfo.toolCount) {
                                    document.getElementById('<%= lblToolCount.ClientID %>').innerHTML = node.addInfo.toolCount;
                                if (node.addInfo.procCount) {
                                    document.getElementById('<%= lblProcCount.ClientID %>').innerHTML = node.addInfo.procCount;
                                if (node.addInfo.noteCount) {
                                    document.getElementById('<%= lblNoteCount.ClientID %>').innerHTML = node.addInfo.noteCount;
                                var txtTaskName = $find('<%= txtTaskName.ClientID %>').set_value(node.labels[0].text);

I also have a change event on a textbox - you'll see evidence of that in the console log as well.  Please ignore.

Any idea what I am doing wrong?

What technique should I be using to determine the # of objects selected?



Attachment: Syncfusion__Determining_Number_of_Objects_Selected__22Mar2015_f1a7c39c.zip

Shyam G [Syncfusion]
Replied On March 23, 2015 11:29 AM UTC

Hi Jim

Thanks for using Syncfusion products.

We are able to reproduce the issue and we have confirmed this as bug and logged a report on this. Also we have created a support incident under your account to track the status of this issue.

Please log on to our support website to check for further updates.


Please let me know if you have any questions.


Shyam G


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon