Fórumok

aui:select store

thumbnail
Fabio Foglia, módosítva 12 év-val korábban

aui:select store

Junior Member Bejegyzések: 61 Csatlakozás dátuma: 2011.09.02. Legújabb bejegyzések
Hi All,

I need to fill a aui:select store with dynamic select as did for Region Country User Settings.

What is the best way?

I have to put:

List<Country> countries = CountryServiceUtil.getCountries();
List<Region> regions = RegionServiceUtil.getRegions();

in page scope or there is a better way to pass to jsp the store to fill the aui:select?

Can you show me some example?

Thanks

Fabio
thumbnail
Thiago Leão Moreira, módosítva 12 év-val korábban

RE: aui:select store

Liferay Legend Bejegyzések: 1449 Csatlakozás dátuma: 2007.10.10. Legújabb bejegyzések
Take a look for an Ajax call at /portal/portal-web/docroot/html/portlet/directory/organization_search.jsp
thumbnail
Fabio Foglia, módosítva 12 év-val korábban

RE: aui:select store

Junior Member Bejegyzések: 61 Csatlakozás dátuma: 2011.09.02. Legújabb bejegyzések
I found some tip but in my portlet I need to execute:

themeDisplay.setIncludeServiceJs(true)

how and where can I create a themeDisplay object?

I've tryied to include in my view.jsp with unresolved object error.... emoticon

The final question is to use Liferay.Address.getCountries service.

And if I have in my page:

<%
List<Country> countries = CountryServiceUtil.getCountries();
List<Region> regions = RegionServiceUtil.getRegions();
%>

How can I assign the list (example countries) to to aui:select???

Thank you

Fabio
thumbnail
Thiago Leão Moreira, módosítva 12 év-val korábban

RE: aui:select store

Liferay Legend Bejegyzések: 1449 Csatlakozás dátuma: 2007.10.10. Legújabb bejegyzések
themeDisplay is an implicit object and it is available through tag <liferay-theme:defineObjects />. For instance


&lt;%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %&gt;

<liferay-theme:defineobjects />

&lt;% 
themeDisplay.setIncludeServiceJs(true);
%&gt;
thumbnail
Fabio Foglia, módosítva 12 év-val korábban

RE: aui:select store

Junior Member Bejegyzések: 61 Csatlakozás dátuma: 2011.09.02. Legújabb bejegyzések
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ page import="java.util.List" %>
<%@ page import="com.liferay.portal.service.CountryServiceUtil" %>
<%@ page import="com.liferay.portal.service.RegionServiceUtil" %>
<%@ page import="com.liferay.portal.model.Country" %>
<%@ page import="com.liferay.portal.model.Region" %>
<%@ page import="com.liferay.portal.theme.ThemeDisplay" %>

<script src="/html/js/liferay/service.js" type="text/javascript"></script>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>

<portlet:defineObjects />

<%
themeDisplay.setIncludeServiceJs(true);
%>

result:

themeDisplay cannot be resolved

emoticon
thumbnail
Mani kandan, módosítva 12 év-val korábban

RE: aui:select store

Expert Bejegyzések: 492 Csatlakozás dátuma: 2010.09.15. Legújabb bejegyzések
Fabio Foglia:


result:

themeDisplay cannot be resolved

emoticon


You need to create object for themeDisplay,


ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(com.liferay.portal.kernel.util.WebKeys.THEME_DISPLAY);
thumbnail
Fabio Foglia, módosítva 12 év-val korábban

RE: aui:select store

Junior Member Bejegyzések: 61 Csatlakozás dátuma: 2011.09.02. Legújabb bejegyzések
Thank you Mani...It works !!!

Do you know where is the logic to manage a 3th level of indirection?

I need to expand the login to a 3th combo box depending on regionid as did for countries.

I have a new "city" table on db populated with city areas and linked to regionid of region table as did for coutries.

I have to manage the same mechanism to fill the 3th combo on region combo data.

Thanks

Fabio
mehmet tasar, módosítva 12 év-val korábban

RE: aui:select store

Junior Member Bejegyzések: 49 Csatlakozás dátuma: 2011.03.06. Legújabb bejegyzések
Fabio Foglia:
Thank you Mani...It works !!!

Do you know where is the logic to manage a 3th level of indirection?

I need to expand the login to a 3th combo box depending on regionid as did for countries.

I have a new "city" table on db populated with city areas and linked to regionid of region table as did for coutries.

I have to manage the same mechanism to fill the 3th combo on region combo data.

Thanks

Fabio


how can we add 3item.. i want to add new list which come from my db.
can i use my serviceutil instead of Liferay.Address.getCountries?
thumbnail
Tanweer Ahmed ., módosítva 1 év-val korábban

RE: aui:select store

Expert Bejegyzések: 322 Csatlakozás dátuma: 2010.03.11. Legújabb bejegyzések
Fabio Foglia:
Hi All,

I need to fill a aui:select store with dynamic select as did for Region Country User Settings.

What is the best way?

I have to put:

List<Country> countries = CountryServiceUtil.getCountries();
List<Region> regions = RegionServiceUtil.getRegions();

in page scope or there is a better way to pass to jsp the store to fill the aui:select?

Can you show me some example?

Thanks

Fabio



Hi Fabio,

Find the code below to achieve Country > Region functionality using Dynamic Select
<aui:script use="liferay-dynamic-select,aui-io-request">
			new Liferay.DynamicSelect(
				[
					{
						select: '<portlet:namespace />countryId',
						selectData: Liferay.Address.getCountries,
						selectDesc: 'name',
						selectId: 'countryId',
						selectVal: ''
					},
					{
						select: '<portlet:namespace />regionId',
						selectData: Liferay.Address.getRegions,
						selectDesc: 'name',
						selectId: 'regionId',
						selectVal: ''
					}
				]
			);
</aui:script>
<aui:field-wrapper>
	<aui:column columnwidth="20">Country</aui:column>
	<aui:column><aui:select label="" name="countryId" /></aui:column>
</aui:field-wrapper>

<aui:field-wrapper>
	<aui:column columnwidth="20">Region</aui:column>
	<aui:column><aui:select label="" name="regionId" /></aui:column>
</aui:field-wrapper>


Don't forget to include the service.js file in your jsp.

Alternatively you can achieve the same functionality using Ajax.

Hope this helps,
Regards,
Tanweer
mPowerian-BoschLer
thumbnail
Dave Weitzel, módosítva 10 év-val korábban

RE: aui:select store

Regular Member Bejegyzések: 208 Csatlakozás dátuma: 2009.11.18. Legújabb bejegyzések
sorry to pick up this thread after it appears to be resolved.

I have an issue on using DynamicSelect as in the classic adddresses pages:

<aui:script use="liferay-dynamic-select">
				
				new Liferay.DynamicSelect(
					[
						{
							select: '<portlet:namespace />addressCountryId&lt;%= addressesIndex %&gt;',
							selectData: Liferay.Address.getCountries,
							selectDesc: 'name',
							selectId: 'countryId',
							selectVal: '&lt;%= countryId %&gt;'
						},
						{
							select: '<portlet:namespace />addressRegionId&lt;%= addressesIndex %&gt;',
							selectData: Liferay.Address.getRegions,
							selectDesc: 'name',
							selectId: 'regionId',
							selectVal: '&lt;%= regionId %&gt;'
						}
					]
				);
			</aui:script>


I am trying to put this on a public page to create users, I am getting JSON response "{"exception":"Please sign in to invoke this method""

I can include "List<Country> countries = CountryServiceUtil.getCountries();" without any security issues but obviously do not get the list changes from changing the country

I have even switched off JSON security tokens in portal-ext.properties:
json.service.auth.token.enabled=false

So what is causing a security issue here and how can it be made public?