2017-04-09 12 views
0

私はLiferay 6.2をポータルプラットフォームとして使用しています。私の質問は、ポートレットをajax経由で読み込む方法がある場合ですか?ポートレットIDのみを提供します。Liferay 6.2 - クライアント側からポートレットをロード

これはポートレット情報です:

<portlet> 
    <portlet-name>my_portlet</portlet-name> 
    <instanceable>false</instanceable> 
    <private-session-attributes>false</private-session-attributes> 
    <header-portlet-javascript>/js/my_portlet/app.js</header-portlet- 
</portlet> 

<portlet> 
    <portlet-name>my_portlet</portlet-name> 
    <display-name>My Portlet</display-name> 
    <portlet-class>com.ui.portlets.generic.GenericPortlet</portlet-class> 
    <init-param> 
     <name>view-template</name> 
     <value>/view.jsp</value> 
    </init-param> 
    <expiration-cache>0</expiration-cache> 
    <supports> 
     <mime-type>text/html</mime-type> 
    </supports> 
    <portlet-info> 
     <title>myportlet</title> 
    </portlet-info> 
</portlet> 

私は(ジャバスクリプトによって)クライアント側からするHTMLポートレットをレンダリング取得すると、すべてのそれのparamsパラメータとファイルが含まれて?

答えて

1

クリーンな方法ではありませんが、私は他の何かを認識していません。

ウィジェットURLと呼ばれるものがあります。

ポートレットの設定によって取得できます。

enter image description here

今iframe内にこのURLをロードします。ページを更新せずにプロットをロードするという目的を達成します。

ここにいくつかのサンプルスニペットがあります。

window.Liferay = window.Liferay || {}; 

Liferay.Widget = function(options) { 
    options = options || {}; 

    var id = options.id || '_Liferay_widget' 
      + (Math.ceil(Math.random() * (new Date).getTime())); 
    var height = options.height || '100%'; 
    var url = options.url 
      || 'http://www.liferay.com/widget/web/guest/community/forums/-/message_boards'; 
    var width = options.width || '100%'; 

    var html = '<iframe frameborder="0" height="' + height + '" id="' + id 
      + '" src="' + url + '" width="' + width + '"></iframe>'; 
    return html; 
} 
関連する問題