Jay Trivedi
Jay Trivedi

Reputation: 464

Searchcontainer Pagination with tabs

I have 3 tabs ie. 3-Jsp and one main Jsp That includes all the tabs. All the tabs have searchcontainer. When i click on next it automatically sends me to first tab. My tabs are perfect problem occurs only when action fires on searchcontainer.

">

    <liferay-ui:search-container-results
        results="<%=ListUtil.subList(users, searchContainer.getStart(), searchContainer.getEnd()) %>"
        total="<%=usersNameList.size() %>"
    />
        <liferay-ui:search-container-row
            className="com.liferay.portal.model.User"
            keyProperty="userId"
            modelVar="userToDisplay"
        >
            <liferay-ui:search-container-column-text
                name="UserName"
                value="<%=userToDisplay.getFullName() %>"
            />

What should i write in iteratorurl to overcome this problem.. help me out.

Thanks Jay

Upvotes: 4

Views: 3484

Answers (1)

Jay Trivedi
Jay Trivedi

Reputation: 464

Friends I got the solution.

<%
    PortletURL url= renderResponse.createRenderURL();  
//creates a portlet url and now add the attributes that make you traverse till current page.
//In my case view->Group tab -> Add Users(addUserSelected is action) -> SearchContainer
// tabs 1 takes value group
//action is addUserSelected so it will traverse till here
//Now only set this url in Iterator URL in search container
    url.setParameter("tabs1", "Group");
    url.setParameter("actionvalue","user");
    url.setParameter("action","addUserSelected"); //name of action by which you get the page on current tab
    url.setParameter("typePage","adduser");
%>


<liferay-ui:search-container delta="10" emptyResultsMessage="Data-Not-Found" iteratorURL="<%=url %>" >

    <liferay-ui:search-container-results
        results="<%=ListUtil.subList(users, searchContainer.getStart(), searchContainer.getEnd()) %>"
        total="<%=usersNameList.size() %>"
    />
        <liferay-ui:search-container-row
            className="com.liferay.portal.model.User"
            keyProperty="userId"
            modelVar="userToDisplay"
        >
            <liferay-ui:search-container-column-text
                name="UserName"
                value="<%=userToDisplay.getFullName() %>"
            />

            <liferay-ui:search-container-column-text>
                <input type="checkbox" name="userCheck" id="userCheck" value="<%=String.valueOf(userToDisplay.getUserId())%>"/>
            </liferay-ui:search-container-column-text>
            <%-- //<%} %> --%>
        </liferay-ui:search-container-row>
        <liferay-ui:search-iterator/>

</liferay-ui:search-container>

Note: do not use static names inspite you can use

Upvotes: 5

Related Questions