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
close icon

Changing font attributes of a SwimLane title

Hi,

I realize that this is a continuation of a discussion started in Incident 138670, but since it's really a question I wanted to get it in the forums so that others may see it as well.

With the code provided in the Incident I was able to apply a fill color to both the lane headers and the main swimlane title header.
Great.
However when I tried to apply some text attribute changes, like the fontcolor, only the lane headers worked - the swimlane title was not affected.

Here's the function that I'm using to change the font color:

function ApplyTextColor(color) {
                for (var i = 0; i < diagram.model.selectedItems.children.length; i++) {
                    var object = diagram.model.selectedItems.children[i];
                    if (diagram.getObjectType(object) == 'node') { // A node or a text object
                            if (object.textBlock) { // text
                                diagram.updateLabel(object.name, object.textBlock, { fontColor: color });
                            }
                            if (object.labels[0]) { // node
                                diagram.updateLabel(object.name, object.labels[0], { fontColor: color });
                            }
                    } else if (object.isSwimlane || object.isLane) {
                        object = diagram.getNode(object.name);
                        if (object.children && object.children.length > 0) { // Main SwimLane Title - is this correct?
                            var child = diagram.findNode(object.children[0]);
                            if (child) {
                                diagram.updateLabel(child.name, child.labels[0], { fontColor: color }); // Does not work :(
                            }
                        } else { // One of the Lanes - This works for the lane headers only
                            var header = object.header;
                            header.fontColor = color;
                            diagram.updateNode(object.name, { header: header });
                        }
                    } else { // Must be a connector
                        if (object.labels[0]) {
                            diagram.updateLabel(object.name, object.labels[0], { fontColor: color });
                        }
                    }
                }

Thanks for any advice on getting this to work.

Jim

5 Replies

SG Shyam G Syncfusion Team May 11, 2015 02:30 PM UTC

Hi Jim

Thanks for using Syncfusion products.

Please note that you can use “updateNode” API method to achieve your requirement. We have modified your code snippet and provided below.

Code snippet:

function ApplyTextColor(color) {

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

var object = diagram.model.selectedItems.children[i];

if (diagram.getObjectType(object) == 'node') { // A node or a text object

----------

----------

} else if (object.isSwimlane || object.isLane) {

object = diagram.getNode(object.name);

// One of the Lanes - This works for the lane headers only

var header = object.header;

header.fontColor = color;

diagram.updateNode(object.name, { header: header });


} else { // Must be a connector

if (object.labels[0]) {

diagram.updateLabel(object.name, object.labels[0], { fontColor: color });

}

}

}
}

Please let me know if any concerns.

Regards,
Shyam G



JJ Jim Jacobs May 11, 2015 03:08 PM UTC

Hi Shyam,

I tried your code as provided, and it still does not work for the main swimlane title.
It works only for the individual lanes.

See the attached video.
I also checked the console and there were no errors raised.

Help.

Thanks

Jim

Attachment: Syncfusion__SwimLane_Title_Header_Text_Issue__11May2015_e58595cd.zip


SK Senthil Kumar M Syncfusion Team May 12, 2015 12:07 PM UTC

Hi Jim,

Thanks for your update.

We are afraid that we are unable to reproduce the reported issue at our end. Could you please share your whole script file which you have used in your application to update the swimlane/lane header styles or modify the below sample to reproduce the reported issue at our end? This will help us to verify further and provide a better solution to you.

Here is the sample

Sample

Here is the video

video

Please let us know if any concern.

Regards,

Senthilkumar M



JJ Jim Jacobs replied to Senthil Kumar M May 25, 2015 11:25 PM UTC

Hi Jim,

Thanks for your update.

We are afraid that we are unable to reproduce the reported issue at our end. Could you please share your whole script file which you have used in your application to update the swimlane/lane header styles or modify the below sample to reproduce the reported issue at our end? This will help us to verify further and provide a better solution to you.

Here is the sample

Sample

Here is the video

video

Please let us know if any concern.

Regards,

Senthilkumar M


Hi,

Since the set of fixes that were provided to me on May 22nd, changes to the swimlane title are working fine.

Jim


SG Shyam G Syncfusion Team May 26, 2015 11:03 AM UTC

Hi Jim

Thanks for your update.

We are happy to hear that your problem is resolved.

Please let me know if any concerns.

Regards,
Shyam G

Loader.
Live Chat Icon For mobile
Up arrow icon