data table checkbox selection issues

UI Components for JSF
maya
Posts: 25
Joined: 23 Aug 2010, 13:44

12 Oct 2010, 06:38

Hi

I am using PRIMEFACES 2.2 m1 and JSF 2.0 ... I am trying to implement lazyloading pagination with check box selection. Its working fine, but there is an issue
ex : if i m using rows attribute as 2 in datatable, but my table content had six rows so it should seperate three pages , If I click the select all check box i want to select my first page rows only no need to select the whole page rows .is there is any way to solve this ?

regards
Maya

User avatar
sreenivas.svs
Posts: 6
Joined: 15 Jul 2010, 08:20

12 Oct 2010, 07:47

Hello Maya

I am also facing the same problem.Solutions will be appreciated.



Regards
svs

maya
Posts: 25
Joined: 23 Aug 2010, 13:44

12 Oct 2010, 09:18

HI all

If we are trying to implement lazyloading pagination with check box selection . when ever you click the check box all , everything will be select and we would perform any kind of operation .. but here if the user using first page and select the checkbox all and do some operation means the whole data (I mean Page )wil be affect . I think its not a good way of user supported interface . any way to acheive this or solve this ?


Regards
Maya

maya
Posts: 25
Joined: 23 Aug 2010, 13:44

12 Oct 2010, 13:30

Hi Optimums.Prime


What I am thinking is still you could not understand my explanation.. so again i am trying to explain with good English

I am Using prime faces 2.2 m1 and J SF 2.0 .. I am trying to apply lazy loading pagination with check box selection
My problem is when i select an check box in first page , it work fine,
See here
http://img259.imageshack.us/i/pagination.png/

but, in the second and next page , the first item i selected is shown again in the update panel (just when i click the second or next page ,even i didn't select any check box in second or next page ).


see here

http://img219.imageshack.us/i/pagination2.png/


my client page coding is

<p:dataTable
sortDescMessage="Welcome descending" selection="#{bus.busDataSelect}"
sortAscMessage="welcome ascending" errorMessage="Try Again !"
emptyMessage="No data found with given criteria" dynamic="fa"
var=" Message" rendered="true" first="0"
value="#{bus.busBasedLazyData}" paginator="true"
rows="5" lazy="true" rowIndexVar="rowIndex"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="10,20,30">

<p:column selectionMode="multiple" />

<p:column headerText="Id">
<h:outputText value="#{Message.Id}" />
</p:column>

<p:column headerText="Bus Number">
<h:outputText value="#{ Message.Number}" />
</p:column <f:facet name="footer">
<p:commandButton value="View" actionListener="#{bus.updateBus}" />
</f:facet>
</p:dataTable>




my UIBean is


public PaginationUIBean() {

Bean rowCount = new Bean();
rowCount.setStatus( );
rowCount = get Service().findcountBy Status(rowCount);
totalRows = Integer.parseInt(rowCount.getCount());
BasedLazyData = new LazyDataModel< Bean>() {

public List< Bean> load(int first, int pageSize,
String sortField, boolean sortOrder,
Map<String, String> filters) {
List< Bean> statusMsgDetailsList = new ArrayList< Bean>();
LoadLazyData(statusMsgDetailsList, first, pageSize, sortField,
sortOrder, filters);

return statusMsgDetailsList;
}

};

BasedLazyData.setRowCount(totalRows);

}

private void LoadLazyData(List< Bean> statusMsgDetailsList,
int first, int pageSize, String sortField, boolean sortOrder,
Map<String, String> filters) {

// List<PaymentBean> statusMsgBasedLazyDataList = null;

Bean Bean = new Bean();
Bean.setStatus( );
Page page = new Page();
page.setPageNo(first);

page.setPageSize(pageSize);
page.setAutoCount(true);
page.setParameterPassEnabled(true);

Bean.setPage(page);
Bean = get Service().find DetailsList(
Bean);
LazyDataList = Bean.get StatusList();
if ( LazyDataList != null && LazyDataList.size() > 0) {
for ( Bean Msg : LazyDataList) {
statusMsgDetailsList.add(Msg);
}
}
}

callahan
Posts: 768
Joined: 27 May 2010, 22:52

12 Oct 2010, 14:12

Hi,

It looks like an issue that needs to be fixed. When lazy loading and pagination are used together, the DataTable has issues distinguishing between the rows on each page. For example, the DataTable appears to think that the 5th row on the first page is the same as the 5th row on the all other pages. A variant of this isuue can be seen on the following showcase page: http://www.primefaces.org/showcase/ui/datatableLazy.jsf. If a row is selected on the first page, the same row will be selected on all pages. I think you should create an issue for this.

maya
Posts: 25
Joined: 23 Aug 2010, 13:44

12 Oct 2010, 14:45

hi callahan


thanks for your reply .really i expected your reply ,you have done a great job , thanks alot .Actually i want to handle with lacks of data .. so i prefered lazyloading is the one of the good solution ,thats why i implemented that .Is there is any other way to acheive this with check box selection ...

regards

maya

callahan
Posts: 768
Joined: 27 May 2010, 22:52

12 Oct 2010, 14:56

Well, you can achieve it without lazy loading http://www.primefaces.org/showcase/ui/d ... eckbox.jsf. I'm not aware of a workaround when lazy loading is used.

maya
Posts: 25
Joined: 23 Aug 2010, 13:44

12 Oct 2010, 15:06

hi Callahan

thanks . I know that , but i have one doubt with using lazy loading in programmatic we cant do anything , like each next page we can do any set index is null in our backing bean or any other ways ? .


regards
Maya

maya
Posts: 25
Joined: 23 Aug 2010, 13:44

14 Oct 2010, 11:39

hi optimus.prime

Could you tel me is there is any way to do the check box selction using lazyloading (Shall we use any object binding for this in backing bean or in backing bean shall we set any attributes like setindex() ) without any issues ...

regards
Maya ..

maya
Posts: 25
Joined: 23 Aug 2010, 13:44

17 Oct 2010, 12:16

hi optimus.prime

I know your guidelines. but still i am not getting any reply . so i am asking please tel me there is any other way to solve this problem .Else this is a primefaces bug ? Is there is any other release with fixed bugs ?

regards
Maya
Last edited by maya on 18 Oct 2010, 06:39, edited 2 times in total.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 45 guests