function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
raj123raj123 

Clear Check Boxes on Page Bock Table

I have a Page Bock Table on my visualforce page which has a checkbox column, to select particular records and update. This Page also has the Pagination.

 

To Update the selected records there is a button which opens up a popup.

 

This popup has 2 buttons  one to Update and other button  "cancel" to close the popup..

 

The problem here is when  i click Cancel button on the popup the  checkboxes are not clearing up, i am clearing the selected records list inside the cancel method.

 

Cancel Method.

 

public PageReference Cancel1()
{
displayPopup = false;
//viewSortData();  // function to query and populate the table with updated values , if they update some records. 
selectedCases.clear();  // selected cases - list of wrapper class type, where is selected is a vatiable.
return null;
}

 

can someone help in clearing the checkboxes once cancel is clicked.

 

2. There is one more problem, when i select some records and update the  records that are in second or third page , as i have the pagination.

 

After the update the i am refereshing the pageblock table to reflect the changes, and it lands on  the first page after refresh with updated values, the problem here is user have to navigate to the page to see the changes made.

 

how to make it to land on the same page they have updated, so that they don't have to nagivate. 

 

 

bob_buzzardbob_buzzard

How are your checkboxes rendered?

yvk431yvk431

instead of a popup, why cant you navigate to the same page using the same controller so that the state will be maintained which will be a bit easier than your current functionality.

raj123raj123

Ho Bob , i am renderinf the checkbox in the following way 

 

<apex:column >
<apex:facet name="header">
<input type="checkbox" onclick="checkAll(this)" />
</apex:facet>
<apex:inputCheckbox value="{!record.isSelected}" id="checkedone"/>
</apex:column>

bob_buzzardbob_buzzard

Can you explain how the popup is related to the main page in terms of the controller and action method?  If the cancel in the popup invokes a controller method, will the popup will be rerendered rather than the main page?