#you'll need to do the `toAnchor` call

1 messages · Page 1 of 1 (latest)

wheat nest
#

Hi there, I hope a can get back (very belatedly) to this older topic and suggestion of yours!

#

Because in the meantime I've managed to get my items instantiated (against my expectations) and even get the output from toAnchor()!
Its "outerHTML" attribute looks something like this:

<a class="content-link" draggable="true" data-link="" data-uuid="Item.QXksqpLBndRMocMQ" data-id="QXksqpLBndRMocMQ" data-type="Item" data-tooltip="Item" data-tooltip-text="Consumable Item">
                                <i class="fa-solid fa-suitcase" inert=""></i>Healing Potion QL3</a>
#

Pasting this outerHTML into my template (as a static preliminary test) produces a REAL clickable link.
So far, I am very happy! Only that clicking the link does nothing (not even a console error). Am I missing something important here?

#

E.g., I can see that the data-link attribute is empty (suppose that's the culprit?)

steel dirge
#

Took a look, not sure why that's not working for you

#

data-link being empty is expected

#

it just fetches from data-uuid

wheat nest
#

Thanks for replying! 👍 Meanwhile I've digged somewhat deeper and found an alternative solution using data-action and a custom event listener method. Now I am only passing my item's id via "data-id" and do the rest with item.sheet.render(). Seems to work, as far as I can tell by now.

wheat nest
#

And btw, just for completeness, I'd like to let you know, how I solved the crucial part (to create real world items on the fly, so that I can finally use them to render the details sheet):
Luckily I found out that Monk has already implemented something for that at a completely different spot, from where I could copy it. He is using ...

const item = CONFIG.Item.documentClass(<itemData>);
// ...
item.sheet.render(true);

Apparently, his itemData is structured in the correct way so that it is accepted by the documentClass() method.