Andreas Tasoulas
Andreas Tasoulas

Reputation: 453

Modifying Liferay javascript functionality

I want some tags to be added to an article. The problem is that the tags are displayed in the pop-up window in "random" order. This is due to order they are pushed to the page. I want to intervene, sort the tags and present them ordered. How would you do that? I spotted the methods in tags_entries_selector.js, but I am not really sure where to start.

Upvotes: 0

Views: 1261

Answers (2)

Andreas Tasoulas
Andreas Tasoulas

Reputation: 453

The main idea of the solution is to keep all tags in an array and not display anything until that array has 'filled'. To understand when the latter happens, compare your array's length to vocabularies.length. Perform all the necessary (not trivial) modifications inside your custom array, convert its data to string and pass it to container.html().

The main point to understand is that the instance._getVocabularyEntries() function is executed for each entry, but we only want it to execute it only when our custom array 'fills' with all the necessary data. This solution has the disadvantage that all required data must be fetched before displaying anything to the user.

Upvotes: 0

Jaromir Hamala
Jaromir Hamala

Reputation: 1890

There are 2 basic ways how to extend Liferay Portal:

  • Ext Environment
  • Hooks

Ext Environment is powerful technique, but might be a bit difficult. For hooks you can look at this: http://jdem.cz/bfms4

Upvotes: 1

Related Questions