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.
Unfortunately, activation email could not send to your email. Please try again.

How to determine # of objects selected

Thread ID:

Created:

Updated:

Platform:

Replies:

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

Hi,

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:

diagram.model.selectedItems.children.length

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;
                    diagram.updateUserHandles(args.element);
                } else {
                    var handles = diagram.model.selectedItems.userHandles;
                    handles[0].visible = false;
                    diagram.updateUserHandles(args.element);
                }
                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?

Thanks

Jim


Attachment: Syncfusion__Determining_Number_of_Objects_Selected__22Mar2015_f1a7c39c.zip

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

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.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Regards,

Shyam G


CONFIRMATION

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.

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.

;