samedi 1 avril 2017

how to select all booleancheckbox using jsf primefaces?

ok guys, i know theres another related question like mine, but i ve tried that solution but still not work at all. heres my jsf

<h:form id="store-news-check">
                    <ul style="list-style: none;padding:5px;margin-top:0px">
                        <ui:repeat value="#{dashboardBean.storeNewsList}" var="item" varStatus="status">
                            <li style="display:inline-flex;width: 100%;margin-bottom: 5px">
                                <p:selectBooleanCheckbox value="#{item.cmsCheck}" style="margin-bottom:0px" />
                                <a href="#" style="color:#333"><span class="task-name">#{item.storeId.name} - ${fn:substring(item.title,0, 10)} ....</span></a>
                            </li>
                        </ui:repeat>
                    </ul>

                    <p:commandButton actionListener="#{dashboardBean.selectAllNews()}" value="Select All" icon="ui-icon-send" style="border-radius:3px 0px 0px 3px"/>
                    <p:commandButton type="button" value="Save" icon="ui-icon-send" style="border-radius:0px 3px 3px 0px"/>
                </h:form>

and heres my backing bean

    private List<StoreNews> storeNewsList;    

public List<StoreNews> getStoreNewsList() {

        return storeNewsList = storeNewsFacade.findStoreNewsDashbroad();

    }

public void selectAllNews(){
        for(StoreNews sn:storeNewsList){
            sn.setCmsCheck(true);
        }

        infoMessage("check all store news");
    }

hope you guys can help me, thanks !




Aucun commentaire:

Enregistrer un commentaire