Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

How to set style of parent object in child object

$
0
0

@Jashka wrote:

$("CheckBox", "choice",
                    {
                        row: 2,
                        column: 0,
                        "Button.width": 20,
                        "Button.height": 20,
                        "ButtonBorder.figure": "Circle",
                        "ButtonBorder.stroke": "blue",
                        "ButtonIcon.figure": "Circle",
                        "ButtonIcon.fill": "blue",
                        "ButtonIcon.strokeWidth": 0,
                        "ButtonIcon.desiredSize": new go.Size(10, 10)
                    },
                    $(go.TextBlock, "is hidden"),
                    {
                        "_doClick": function (e, obj) {

                            console.log( obj.findObject('SHAPE') ); // null ? why ?

                            let hiddenItems = document.querySelector('.hidden-items');
                            let choice = obj.part.data.choice;

                            obj.part.data.draggable = !!obj.part.data.choice;

                            if (choice) {
                                let li = document.createElement('li');
                                li.setAttribute('data-obj', JSON.stringify(obj.part.data));
                                li.classList.add(`item-hidden-${obj.part.data.key}`);
                                li.textContent = obj.part.data.name;
                                hiddenItems.appendChild(li);
                            } else {
                                let li = document.querySelector(`.item-hidden-${obj.part.data.key}`);
                                if (li) {
                                    li.remove();
                                }
                            }
                        }
                    }
                ),

$(go.Shape, "Rectangle",
            {
                name: "SHAPE", fill: "white", stroke: null,
                portId: "", fromLinkable: true, toLinkable: true, cursor: "pointer"
            }),

console.log( obj.findObject('SHAPE') ); // null ? why ? find only in children of choice ?
and how to change SHAPE opacity on choice click ?
how to change choice title

Please, help me.
Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles