フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Fabio Foglia
aui:select store
2011/09/15 7:00
答え

Fabio Foglia

ランク: Junior Member

投稿: 61

参加年月日: 2011/09/02

最近の投稿

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
Thiago Leão Moreira
RE: aui:select store
2011/09/15 9:01
答え

Thiago Leão Moreira

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1388

参加年月日: 2007/10/10

最近の投稿

Take a look for an Ajax call at /portal/portal-web/docroot/html/portlet/directory/organization_search.jsp
Fabio Foglia
RE: aui:select store
2011/09/15 9:16
答え

Fabio Foglia

ランク: Junior Member

投稿: 61

参加年月日: 2011/09/02

最近の投稿

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
Thiago Leão Moreira
RE: aui:select store
2011/09/15 10:30
答え

Thiago Leão Moreira

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1388

参加年月日: 2007/10/10

最近の投稿

themeDisplay is an implicit object and it is available through tag <liferay-theme:defineObjects />. For instance

1
2<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
3
4<liferay-theme:defineObjects />
5
6<%
7themeDisplay.setIncludeServiceJs(true);
8%>
Tanweer Ahmed Ansari
RE: aui:select store
2011/09/15 10:32
答え

Tanweer Ahmed Ansari

ランク: Regular Member

投稿: 217

参加年月日: 2010/03/11

最近の投稿

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
 1<aui:script use="liferay-dynamic-select,aui-io-request">
 2            new Liferay.DynamicSelect(
 3                [
 4                    {
 5                        select: '<portlet:namespace />countryId',
 6                        selectData: Liferay.Address.getCountries,
 7                        selectDesc: 'name',
 8                        selectId: 'countryId',
 9                        selectVal: ''
10                    },
11                    {
12                        select: '<portlet:namespace />regionId',
13                        selectData: Liferay.Address.getRegions,
14                        selectDesc: 'name',
15                        selectId: 'regionId',
16                        selectVal: ''
17                    }
18                ]
19            );
20</aui:script>
21<aui:field-wrapper>
22    <aui:column columnWidth="20">Country</aui:column>
23    <aui:column><aui:select label="" name='countryId' /></aui:column>
24</aui:field-wrapper>
25
26<aui:field-wrapper>
27    <aui:column columnWidth="20" >Region</aui:column>
28    <aui:column><aui:select label="" name='regionId' /></aui:column>
29</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
Fabio Foglia
RE: aui:select store
2011/09/16 0:40
答え

Fabio Foglia

ランク: Junior Member

投稿: 61

参加年月日: 2011/09/02

最近の投稿

<%@ 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
Manikandan S
RE: aui:select store
2011/09/16 1:31
答え

Manikandan S

ランク: Expert

投稿: 492

参加年月日: 2010/09/15

最近の投稿

Fabio Foglia:


result:

themeDisplay cannot be resolved

emoticon


You need to create object for themeDisplay,

1
2ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(com.liferay.portal.kernel.util.WebKeys.THEME_DISPLAY);
Fabio Foglia
RE: aui:select store
2011/09/16 4:21
答え

Fabio Foglia

ランク: Junior Member

投稿: 61

参加年月日: 2011/09/02

最近の投稿

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
RE: aui:select store
2011/11/16 1:39
答え

mehmet tasar

ランク: Junior Member

投稿: 47

参加年月日: 2011/03/06

最近の投稿

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?
Dave Weitzel
RE: aui:select store
2013/05/06 20:37
答え

Dave Weitzel

ランク: Regular Member

投稿: 169

参加年月日: 2009/11/18

最近の投稿

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:
 1
 2<aui:script use="liferay-dynamic-select">
 3               
 4                new Liferay.DynamicSelect(
 5                    [
 6                        {
 7                            select: '<portlet:namespace />addressCountryId<%= addressesIndex %>',
 8                            selectData: Liferay.Address.getCountries,
 9                            selectDesc: 'name',
10                            selectId: 'countryId',
11                            selectVal: '<%= countryId %>'
12                        },
13                        {
14                            select: '<portlet:namespace />addressRegionId<%= addressesIndex %>',
15                            selectData: Liferay.Address.getRegions,
16                            selectDesc: 'name',
17                            selectId: 'regionId',
18                            selectVal: '<%= regionId %>'
19                        }
20                    ]
21                );
22            </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?