0

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

frank86ba
  • 23
  • 6
  • Issue is not clear based on what details you have provided? But I see fundamental issue with using checkbox as column, you have to provide unique id and name value for each row's checkbox. See if you can use search container's feature rowchecker. – Pankaj Kathiriya Apr 14 '16 at 16:43
  • Thanks for reply Kathiriya, I tried setting id and name for the checkbox, but still the problem persists: when I open the page the column is shown like text - that is the problem I have. – frank86ba Apr 15 '16 at 07:44

1 Answers1

0

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.

Community
  • 1
  • 1
Peter B
  • 257
  • 2
  • 3