-
1. Re: how to get list from rich:dataTable on click of commandbutton whose immediate="true" .
healeyb Jul 15, 2012 8:50 AM (in response to aniketmurtarkar)>to bypass the form validation i have used immediate="true" on delete button.
A common misconception, validation will occur during the apply request values phase rather than the process
validations phase. Regardless of this technicality, and despite the fact that you've not posted the code in question,
I'd be looking at the scope of the backing bean (@ViewScoped may be needed) and ensuring that you are using
execute="the id of the any inputs", assuming that you are using ajax (if you use a4j:commandButton/Link, you
are).
Regards,
Brendan.
-
2. Re: how to get list from rich:dataTable on click of commandbutton whose immediate="true" .
aniketmurtarkar Jul 15, 2012 9:51 AM (in response to healeyb)Hello Brendan,
Thanks for reply.
Here is my code snippet. My code is working fine. but now I have tried to use rich validations in my application
but it is now affecting other functionalities.
@ManagedBean()
@RequestScoped
public class CaseMaster {
public String delete() {
try {
this.massage = CommonMassages.deletefailed;
// view status new, view, update, delete
currentAppStatus(false, false, false, true);
CaseMasterOps cmOps = new CaseMasterOps();
List<String> checkedItems = cmOps.listSelectedItems(caseMasterList, checked);
String countDeleted = cmOps.deleteData(checkedItems);
this.massage = countDeleted + CommonMassages.deletesuccess;
} catch (Exception e) {
System.out.println("Exception in MTD Delete()::::" + e.getMessage());
}
return "inputClient";
}
public List<CaseMasterBean> getCaseMasterList() {
public List<CaseMasterBean> getCaseMasterList() {
this.caseMasterList = new ArrayList<CaseMasterBean>();
CaseMasterOps opsObj = new CaseMasterOps();
opsObj.init();
currentDetails();
return this.caseMasterList = opsObj.getCasemaster();
}
}
my jsp code is here
<h:commandButton rendered="#{caseMaster.writePermission}" value="#{lbl['label.add']}" immediate="true" action="#{caseMaster.add}"/>
<h:commandButton rendered="#{caseMaster.viewPermission}" value="#{lbl['label.view']}" immediate="true" action="#{caseMaster.view}"/>
<h:commandButton rendered="#{caseMaster.writePermission}" value="#{lbl['label.save']}" action="#{caseMaster.save}"/>
<h:commandButton rendered="#{caseMaster.updateMode}" value="#{lbl['label.updatedata']}" action="#{caseMaster.updateData}"/>
<h:commandButton rendered="#{caseMaster.updatePermission}" value="#{lbl['label.update']}" immediate="true" action="#{caseMaster.update}"/>
<h:commandButton rendered="#{caseMaster.deletePermission}" value="#{lbl['label.delete']}" immediate="true" action="#{caseMaster.delete}"/>
<rich:dataTable value="#{caseMaster.caseMasterList}" var="cases" id="table"
rows="3" style="width:100%;border: 2px;">
<rich:column style="width:5%;">
<f:facet name="header">
</f:facet>
<h:selectBooleanCheckbox value="#{cases.checked[cases.caseId]}"/>
</rich:column>
<rich:column style="width:5%;">
<f:facet name="header">Id</f:facet>
<h:outputText value="#{cases.caseId}"/>
</rich:column>
<rich:column style="width:10%;">
<f:facet name="header">Number</f:facet>
<h:outputText value="#{cases.caseNo}"/>
<h:outputText value=" of "/>
<h:outputText value="#{cases.caseYearDesc}"/>
</rich:column>
<rich:column style="width:20%;">
<f:facet name="header" >Case Descriptions</f:facet>
<h:outputText value="#{cases.caseTitle }"/>
</rich:column>
<rich:column style="width:10%;">
<f:facet name="header" >View status</f:facet>
<h:outputText value="#{cases.status}"/>
</rich:column>
<rich:column style="width:50%;">
<f:facet name="header" >Attachment</f:facet>
<rich:dataTable value="#{cases.files}" var="file" id="table1"
style="width:100%;border: 0px;">
<rich:column style="width:20%; border: 0px;">
<h:outputText value="#{file.fileDescription}"/>
<h:commandLink actionListener="#{caseMaster.downloadFile}" value=" Download">
<f:param name="fileName" value="#{file.name}"/>
<!-- <f:param name="data" value="# {file.data}"/>-->
<f:param name="caseFileId" value="#{file.caseFileId}"/>
</h:commandLink>
</rich:column>
</rich:dataTable>
</rich:column>
</rich:dataTable>
Here I am using a Request Scope. I have tried using view scope but I was not getting values in my managedbean so I used request scope.
Importantly I dont want to use a session scope.
these are the same form images of different places.
-
3. Re: how to get list from rich:dataTable on click of commandbutton whose immediate="true" .
yyq2009 Jul 16, 2012 1:04 AM (in response to aniketmurtarkar)Hi, to avoid validate, you'd better try use a4j:region tag.
And another solution is join the id of checked items and set the id string(it looks like "1,3,4") to a hidden input, and split it in your bean action, then you would know the checked items.