0
votes

I am not able to pass the selector parameter in the data-sly-resource (when parameter is coming through some external object like java or through some list object). It does not work even though if i initialize a variable using "use" statement and then pass in data-sly-resource statement. However this is working fine when i am passing the hard coded values.

For example , below code works because it has hard coded value 'test value'

        <sly data-sly-test="${item.tileReference}" 
             data-sly-resource.="${item.tileReference @ wcmmode='disabled', selectors='test value',
                 resourceType='abc/tiles/generic-tile'}">
        </sly>

However, below code doesn't pass the parameter value because it is coming through some object. here, 'tile.tileCount' holds the value which i have verified by printing in the html.

        <sly data-sly-test="${item.tileReference}" 
             data-sly-resource.="${item.tileReference @ wcmmode='disabled', selectors=tile.tileCount,
                 resourceType='abc/tiles/generic-tile'}">
        </sly>
1
Without more information to help debug, all I can say is that Sightly does allow you to pass in dynamic values to the selector expression option as you are doing above. I'm assuming that you have a "tile" identifier attached to a "use" block prior to the resource block in question.nateyolles

1 Answers

1
votes

Turns out that Sightly accepts only String as selectors and passing an int value ignores the selector.

Looks like tileCount is an integer, try using a String value instead to fix the issue (the getter method of tileCount can be made to return a String instead of an int).