Foros de discusión
Using Tags Selector code without component
Jan Tošovský, modificado hace 8 años.
Using Tags Selector code without component
Liferay Master Mensajes: 566 Fecha de incorporación: 22/07/10 Mensajes recientes
Dear All,
I am cloning tag selector functionality for choosing custom entries. I've started with default script attached to the standard input, which still works (at least entering entries manually):
But once I clone the original asset_tags_selector.js script and specify it in the page with updated name, the code doesn't render holder stuff <ul><li/></ul> and the following error is reported in the JS console:
TypeError: instance.entryHolder is undefined
-> instance.entryHolder.placeAfter(iconsBoundingBox);
There are just two small changes in my JS clone, both related to 'component' name:
and
Is there any property which needs to be renamed as well to make it working again?
Thanks, Jan
I am cloning tag selector functionality for choosing custom entries. I've started with default script attached to the standard input, which still works (at least entering entries manually):
<div id="<%= namespace + randomNamespace%>tagsSelector" class="lfr-tags-selector-content">
<aui:input name="tagsTitles" type="hidden" />
<input class="lfr-tag-selector-input" id="<%= randomNamespace %>tags" maxlength="75" size="15" title="<liferay-ui:message key=" add-tag">" type="text" />
</div>
<aui:script use="liferay-asset-tags-selector">
new Liferay.AssetTagsSelector({
contentBox: '#<%= namespace + randomNamespace%>tagsSelector',
curEntries: 'foo,bar',
hiddenInput: '#<%= namespace %>tagsTitles',
input: '#<%= randomNamespace %>tags',
instanceVar: '<%= namespace + randomNamespace%>'
}).render();
</aui:script>
But once I clone the original asset_tags_selector.js script and specify it in the page with updated name, the code doesn't render holder stuff <ul><li/></ul> and the following error is reported in the JS console:
TypeError: instance.entryHolder is undefined
-> instance.entryHolder.placeAfter(iconsBoundingBox);
<script src="<%=request.getContextPath()%>/js/asset_xxx_selector.js"></script>
<aui:script use="liferay-asset-xxx-selector">
new Liferay.AssetXXXSelector({
// same as before
}).render();
</aui:script>
There are just two small changes in my JS clone, both related to 'component' name:
AUI.add(
'liferay-asset-xxx-selector',
function(A) {
and
Liferay.AssetXXXSelector = AssetTagsSelector;
Is there any property which needs to be renamed as well to make it working again?
Thanks, Jan
Jan Tošovský, modificado hace 8 años.
RE: Using Tags Selector code without component (Respuesta)
Liferay Master Mensajes: 566 Fecha de incorporación: 22/07/10 Mensajes recientes
In my opinion not all dependencies are resolved properly... which led me to the following:
While asset_tags_selector.js requires couple of modules:
requires: ['array-extras', 'async-queue', 'aui-autocomplete-deprecated', 'aui-io-plugin-deprecated', 'aui-io-request', 'aui-live-search-deprecated', 'aui-template-deprecated', 'aui-textboxlist', 'datasource-cache', 'liferay-service-datasource', 'liferay-util-window', 'yql']
There are three of them not available in webapps\ROOT\html\js\aui (LR 6.2.2)
Jan
While asset_tags_selector.js requires couple of modules:
requires: ['array-extras', 'async-queue', 'aui-autocomplete-deprecated', 'aui-io-plugin-deprecated', 'aui-io-request', 'aui-live-search-deprecated', 'aui-template-deprecated', 'aui-textboxlist', 'datasource-cache', 'liferay-service-datasource', 'liferay-util-window', 'yql']
There are three of them not available in webapps\ROOT\html\js\aui (LR 6.2.2)
- aui-textboxlist (but there is aui-textboxlist-deprecated)
- liferay-service-datasource
- liferay-util-window
Jan