0

我正在开发一个用于显示规则列表以供选择的 portlet。我想关注在我的数据库上选择的内容行(加载的规则变量init.jsp)。

我应该怎么做才能聚焦/突出显示一行?

我应该使用<c:when <c:otherwhise所有的.jsp

我使用此代码显示规则列表:

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

<portlet:defineObjects />

<liferay-ui:search-container emptyResultsMessage="there-are-no-products" delta="5">
    <liferay-ui:search-container-results>
        <% 
        List<IRRule> tempResults = ActionUtil.getRules(renderRequest);
        results = ListUtil.subList(tempResults, searchContainer.getStart(),
        searchContainer.getEnd());

        total = tempResults.size();
        pageContext.setAttribute("results", results);
        pageContext.setAttribute("total", total);
        %>
    </liferay-ui:search-container-results>

    <liferay-ui:search-container-row
        className="com.everis.oriol.inputrules.model.IRRule"
        keyProperty="ruleId"
        modelVar="rule">

        <liferay-ui:search-container-column-text
            name="ruleName"
            property="ruleName"
            />  

        <liferay-ui:search-container-column-text
            name="ruleDescription"
            property="ruleDescription"
            />

        <liferay-ui:search-container-column-jsp
            path="/row.jsp"
            align="right"
            />

    </liferay-ui:search-container-row>

    <liferay-ui:search-iterator />

</liferay-ui:search-container>

init.jsp我的文件中...

<% 
long groupId = themeDisplay.getScopeGroupId();
List<IRSelect> rulesPas = IRSelectLocalServiceUtil.getRule(groupId);

String rules =  rulesPas.get(0).getRuleName();
%>

我真的很想比较...

<liferay-ui:search-container-column-text
    name="ruleName"
    property="ruleName"
    />

和...

rules

谢谢您的帮助

4

1 回答 1

0

我能想到的一种方法是设置标签的bold属性,如果<liferay-ui:search-container-row>元素的值为true

<liferay-ui:search-container-row
        className="com.everis.oriol.inputrules.model.IRRule"
        keyProperty="ruleId"
        modelVar="rule"
        bold="<%=rules.equals(rule.getRuleName()) %>">

...

</liferay-ui:search-container-row>

或者,如果您想要更多选项来设置该行的样式,可以为整行设置一个 CSS 类:

<liferay-ui:search-container-row
    className="com.everis.oriol.inputrules.model.IRRule"
    keyProperty="ruleId"
    modelVar="rule">

    <%
    if (rules.equals(rule.getRuleName())) {
        // here "row" is the ResultRow object, instance for each row
        row.setClassName("my-custom-css-class");
    }
    %>

    <liferay-ui:search-container-column-text
        name="ruleName"
        property="ruleName"
        />

     ...

</liferay-ui:search-container-row>

如果您希望仅该行中的规则列文本应以不同方式显示,而不是整行,则:

<liferay-ui:search-container-column-text
        name="ruleName"
        property="ruleName"
        cssClass="<%=rules.equals(rule.getRuleName()) ? \"my-custom-css-class\" : \"\" %>"
        />
于 2013-04-24T09:56:34.560 回答