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.

Setting properties of selected nodes client side

Thread ID:

Created:

Updated:

Platform:

Replies:

117944 Jan 12,2015 08:14 AM Jan 19,2015 08:11 AM ASP.NET Web Forms 5
loading
Tags: Diagram
Jim Jacobs
Asked On January 12, 2015 08:14 AM

Hi,

As you might know, I am trying to build a diagram application on my own (i.e., not using your DiagramBuilder sample).

I am trying to do what I think is a simple task - changing some properties of the selected nodes.

From your documentation, the following statement should work:

$("#diagramContent").ejDiagram({ selectedItems: { fillColor: "red" } });

...yet nothing happens when I wire this up to fire off a button control.

I've placed an alert in the function so I know it's being called.

What am I doing wrong?

Thanks

Jim



Shyam G [Syncfusion]
Replied On January 13, 2015 02:23 AM

Hi Jim

Thanks for using Syncfusion products.

Please note that the model selectedItems property should support the properties listed below in the online UG documentation link.

Link: http://help.syncfusion.com/ug/js/documents/selector.htm

Currently we don’t have support for the “fillColor” Property for the “selectedItems” property. We consider this as a feature request and created a new incident 133952 on behalf of you related to this forum. We suggest you to follow up the incident for further reference using your direct trac account

Please let me know if any concerns.

Regards,

Shyam G



Jim Jacobs
Replied On January 14, 2015 11:23 AM

Hi,

I was able to accomplish what I needed by using the following code:

function ApplyFillColor(sender, eventArgs) {
        var selectedColor = eventArgs.get_value();
        for (var i = 0; i < diagram.model.selectedItems.children.length; i++) {
            var node = diagram.model.selectedItems.children[i];
            diagram.updateNode(node.name, { "fillColor": selectedColor });
        }
    }

But now I have another question for you.
I'm now attempting to change the properties of the label within a node.
I looked at the online documentation and came up with the following code:

    function ComboBoxChanged(sender, eventArgs) {
        var newFontSize = eventArgs.get_comboBox().get_text();
        for (var i = 0; i < diagram.model.selectedItems.children.length; i++) {
            var node = diagram.model.selectedItems.children[i];
            var label = [];
            label = [{ "fontSize": newFontSize }];
            diagram.updateLabel(node.name, node.labels[0], label);
        }
    }

However, nothing happens.
Can you tell me what I am doing wrong.

Many thanks

Jim

Shyam G [Syncfusion]
Replied On January 15, 2015 03:06 AM

Hi Jim

Thanks for using Syncfusion products.

We are glad to inform you that we have created a sample which meets your requirement and it is available in the below link for download. Could you please check in the below sample and get back to us if you are still facing issues at your end?

Code snippet:

<input type="button" value="updatelabel" onclick="updatelabel()" />

function updatelabel() {

            var diagram = $("#Diagram1").ejDiagram("instance");

            var node = diagram.selectionList[0];

            if (node) {

                if (node.labels[0]) {

                    diagram.updateLabel(node.name, node.labels[0], { fontSize: 20, fontColor: "red" });

                }

            }

        }

Sample:http://www.syncfusion.com/downloads/support/directtrac/117944/labelsample-1366371254.zip

Please let me know if any concerns.

Regards,

Shyam G



Jim Jacobs
Replied On January 15, 2015 06:01 PM

Hi Shyam,

Thanks.

Your code worked.

Jim

Shyam G [Syncfusion]
Replied On January 19, 2015 08:11 AM

Hi Jim

Thanks for the update

Please let us know if you require further assistance on this.

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.

;