To make changes to a channel, the HTML node element of the channel is required. The HTML node element can be obtained using the container.getSelectedChannelByName(channelName) method. This however requires the name of the channel or portlet.
The name can be obtained in the JavaScript logic of a channel using one of the following ways:
If the channel uses JSP files, then the channel name can be substituted dynamically into the JavaScript during execution. For example, in the JavaScript logic you can have a statement like:
container.submitContentForm('<%=jsChannelName%>', '<%=jsChannelName%>_form'); |
The value of jsChannelName will be substituted during runtime by the proper channel name. jsChannelName can be initialized as follows in the JSP:
<dt:obtainChannel channel="$JSPProvider"> <dtpc:providerContext> <dt:getName id="jsChannelName"/> <jx:declare id="jsChannelName" type="java.lang.String" /> : : </dtpc:providerContext> </dt:obtainChannel> |
For more information refer to the portal desktop tag library documentation.
For static HTML files or channels and portlets that do not use JSP, a token, %{CHANNEL_NAME}, can be used in place of the channel name. This token will be replaced by the AJAXTableContainerProvider JavaScript with the appropriate channel name at runtime. For example, a JavaScript can be written as:
container.submitContentForm('%{CHANNEL_NAME}', '%{CHANNEL_NAME}_form'); |
Similarly, a token, %{CHANNEL_ID}, can be used to get the channel node ID.