jeudi 5 décembre 2019

how to keep the cheboxes status using displaytag pagination

I'm generating a table using displaytag and its pagination. This table has seven columns, and in the first one there is a checkbox.

The issue is when I change page with displaytag pagination, I lost the checkboxes status. I know there are a lot of topics talking about that question, but I didn't could resolve.

After identify the rows that was checked I'll submit each object in a List<Object> to my action.

<display:table name="slas" class="table tables-detalhes" pagesize="3" requestURI="/filtraEmissor.do" htmlId="slas" decorator="**path**.SlaSituacaoDecorator">
    <display:setProperty name="basic.msg.empty_list" value="<div id='notFound' style='text-align: center'>Nenhum sla ativo para este emissor.</div>" />
    <display:column style="width:1px; padding-left:5px;" title="<input type='checkbox' style='margin-left:7px;' />">
        <input type="checkbox" style="margin-left:15px;" />
    </display:column>
    <display:column property="codFicha" title="ficha" />
    <display:column property="nomeAditivo" title="aditivo" />
    <display:column property="nomePrestador" title="prestador" />
    <display:column property="inicioVigenciaSla" format="{0,date, dd/MM/yyyy}" title="data status" />
    <display:column property="inicioVigenciaFicha" format="{0,date,dd/MM/yyyy}" title="data entrada" />             
    <display:column property="acao" title="" style="width:1px!important" />
</display:table>

The display column "acao" just exists to apply the breakline from decorator.

public class SlaSituacaoDecorator extends TableDecorator {

    public String getAcao() throws UnsupportedEncodingException {

        StringBuilder acoes = new StringBuilder();

        acoes.append("<tr class='separator'> ");
        acoes.append("  <td colspan='5'></td> ");
        acoes.append("</tr> ");

        return acoes.toString();
    }
}



Aucun commentaire:

Enregistrer un commentaire