You need to sign in to do that
Don't have an account?
msb-appsupport1.3905906418879758E12
Hi,
I have displayed a list of result. And I want to check the on I want with a check function.
How could I do it?
Thanks so much.
The below is related code.
<apex:pageblockSection columns="2" id="result_section">
<apex:pageblockTable value="{!ticket_result_list}" var="tItem" id="result_table">
<apex:column headerValue="Ticket Search Result">
<apex:outputText value="No result" rendered="{!NOT(found)}"/>
<apex:outputText value="{!tItem.name}" rendered="{!found}"/>
</apex:column>
<apex:column headerValue="Check-in">
<apex:commandButton action="{!check}" value="Check-in" reRender="ticket_check_in"/>
</apex:column>
<apex:column headerValue="Uncheck">
<apex:commandButton action="{!uncheck}" value="Uncheck" reRender="ticket_check_in"/>
</apex:column>
</apex:pageblockTable>
</apex:pageblockSection>
public PageReference check() {
//what should I do here to check the on I want.
update ticketFound;
return null;
}
The following is the result list.
How to check whatever I want from a list?
Hi,
I have displayed a list of result. And I want to check the on I want with a check function.
How could I do it?
Thanks so much.
The below is related code.
<apex:pageblockSection columns="2" id="result_section">
<apex:pageblockTable value="{!ticket_result_list}" var="tItem" id="result_table">
<apex:column headerValue="Ticket Search Result">
<apex:outputText value="No result" rendered="{!NOT(found)}"/>
<apex:outputText value="{!tItem.name}" rendered="{!found}"/>
</apex:column>
<apex:column headerValue="Check-in">
<apex:commandButton action="{!check}" value="Check-in" reRender="ticket_check_in"/>
</apex:column>
<apex:column headerValue="Uncheck">
<apex:commandButton action="{!uncheck}" value="Uncheck" reRender="ticket_check_in"/>
</apex:column>
</apex:pageblockTable>
</apex:pageblockSection>
public PageReference check() {
//what should I do here to check the on I want.
update ticketFound;
return null;
}
The following is the result list.
Reference for wrapper class: http://wiki.developerforce.com/page/Wrapper_Class
I have tried your answer. The problem I got is I could not update the selected field.
It seems when I check the checkbox, the value {!tItem.selectedCheck} and {!tItem.selectedUnCheck} could not got update.
Could you tell me how to solve it?
Thanks so much.
The following is my code:
<!-- display the result and check-in -->
<apex:pageblockSection columns="2" id="result_section">
<apex:pageblockTable value="{!ticket_result_list}" var="tItem" id="result_table">
<apex:column headerValue="Ticket Search Result">
<apex:outputText value="No result" rendered="{!NOT(found)}"/>
<apex:outputText value="{!tItem.ticket.name}" rendered="{!found}"/>
</apex:column>
<!-- check box to select which the user want to check-->
<apex:column headerValue="Check-in">
<apex:inputCheckbox value="{!tItem.selectedCheck}"/>
</apex:column>
<apex:column headerValue="Uncheck">
<apex:inputCheckbox value="{!tItem.selectedUncheck}"/>
</apex:column>
<!--
<apex:column headerValue="Check-in">
<apex:commandButton action="{!check}" value="Check-in" reRender="result_table"/>
</apex:column>
<apex:column headerValue="Uncheck">
<apex:commandButton action="{!uncheck}" value="Uncheck" reRender="result_table"/>
</apex:column>
-->
</apex:pageblockTable>
</apex:pageblockSection>
<p />
<apex:commandButton action="{!check}" value="Check-in" reRender="result_table"/>
<p />
<apex:commandButton action="{!uncheck}" value="Uncheck" reRender="result_table"/>
</apex:pageBlock>
--------------------------------------------------------------------------------------------------------------------------------
//check button and uncheck button
public PageReference check() {
List<DisplayTicket> selectedTickets = new List<DisplayTicket>();
for(DisplayTicket selectTic: getTicket_result_List()) {
if(selectTic.selectedCheck == True) {
selectTic.ticket.sbxe1__sbx_Attended__c = TRUE;
update selectTic.ticket;
}
}
selectedTickets = null;
return null;
}
public PageReference uncheck() {
List<DisplayTicket> selectedTickets = new List<DisplayTicket>();
for(DisplayTicket selectTic: getTicket_result_List()) {
if(selectTic.selectedCheck == FALSE && selectTic.selectedUncheck == TRUE) {
selectTic.ticket.sbxe1__sbx_Attended__c = FALSE;
update selectTic.ticket;
}
}
selectedTickets = null;
return null;
}
public class DisplayTicket {
public sbxe1__Ticket__c ticket {
get; set;
}
public Boolean selectedCheck {
get; set;
}
public Boolean selectedUncheck {
get; set;
}
public DisplayTicket(sbxe1__Ticket__c item) {
this.ticket = item;
selectedCheck = false;
selectedUncheck = false;
//this.no_found_msg = 'No result';
}
public String name {
get {return ticket.Name;}
}
public String no_found_msg {
get {return 'No result';}
}
}