frank86ba
frank86ba

Reputation: 23

Liferay Portal 6.2 - checkbox into search container

I created a search container table that contains a column checkbox type, i.e.

                <liferay-ui:search-container-column-text
                    name="territoriale"
                    orderable="<%= true %>"
                >
                    <input type="checkbox" id="territoriale" checked="<%= cmt.getTerritoriale() == 1 %>" />
                </liferay-ui:search-container-column-text>

This table is declared inside a jsp included using liferay-util:include, but can also be refreshed in the next steps by click on search button.

What happen is that when the table appears for the first time, I see that column just with text (value is "1"), when I click search button that runs the ajax call, the resource action return the correct checkbox in column.

Any ideas? Below some screen shot Thanks

Column after page load Column after click on search button

Upvotes: 0

Views: 1154

Answers (1)

Peter B
Peter B

Reputation: 257

This works fine on 6.2 CE ga5:

<liferay-ui:search-container-column-text
    name="checkbox"
    orderable="<%= true %>"
>
 <% String checked = (Math.random() < 0.5) ? "checked" : ""; %>
 <input type="checkbox" <%= checked %>/>
 </liferay-ui:search-container-column-text>

So the root cause of your issue should be somewhere else. You may output cmt.getTerritoriale() into html to check its content.

I think, that checked="<%= cmt.getTerritoriale() == 1 %>" is not correct, you may use checked or nothing. See here about using checked attribute.

You can also use rowchecker as was mentioned in the comments of Pankajkumar Kathiriya.

Upvotes: 0

Related Questions