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
JosephJJosephJ 

pageblocktable not rendering after delete link

I feel like I've wasted enough time tracking it down.Pretty simple thing.

I have a pageBlockTable. One of the links in it, lets me delete that row. After the row is deleted the table should be rerendered so you can see that it has been removed. Currently the record DOES get deleted, but the table is not rerendered. I was wondering if maybe the table is reloading before the record is actually deleteed, causing a 'race' condition type of situation? Anyway, below is the code. Feel free to point out what I am doing wrong.Thanks in advance


<apex:page controller="PagingTasksController1" docType="html-5.0">
    <apex:form >
        <apex:pageBlock title="Tasks" id="pgBlock">
           <apex:pageBlockButtons >
               <apex:commandButton action="{!save}" id="saveButton" value="Save"/>
               <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
           </apex:pageBlockButtons>
 
        <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
                    hideOnEdit="editButton" event="ondblclick"
                    changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
 
          <apex:inputText id="searchBox" value="{!searchText}"/>
           <apex:commandButton value="Search" reRender="pgTable,pgBlock" action="{!findTasks}"/>
           <apex:pageBlockTable value="{!Tasks}" var="tsk" id="pgTable" >
          
                 
          <apex:column headerValue="Action" >
             <apex:outputLink value="{!URLFOR($Action.Task.Delete, tsk.id,['retURL'='/apex/New_Test_task_Assignment'])}"> Delete</apex:outputLink>
           </apex:column>

               
          <apex:column headerValue="Subject">
              <apex:facet name="header">
                    <apex:commandLink value="Subject" action="{!toggleSort}" rerender="pgTable" >
                    <apex:param name="sortField" value="Subject" assignTo="{!sortField}"/>
                    <apex:outputPanel rendered="{!BEGINS(sortField,'Subject')}">
                        &nbsp;<apex:image value="{!IF(sortDir = 'asc','/img/arrowDown.gif','/img/arrowUp.gif')}"/>
                    </apex:outputPanel>
                    </apex:commandLink>
                </apex:facet>    
              
                  <apex:outputField value="{!tsk.Subject}"/>
           </apex:column>
                 
           <apex:column headerValue="Status">
               <apex:facet name="header">
                    <apex:commandLink value="Status" action="{!toggleSort}" rerender="pgTable" >
                    <apex:param name="sortField" value="Status" assignTo="{!sortField}"/>
                    <apex:outputPanel rendered="{!BEGINS(sortField,'Status')}">
                        &nbsp;<apex:image value="{!IF(sortDir = 'asc','/img/arrowDown.gif','/img/arrowUp.gif')}"/>
                    </apex:outputPanel>
                    </apex:commandLink>
              </apex:facet>        
 
             <apex:outputField value="{!tsk.Status}"/>
         </apex:column>
                      
     </apex:pageBlockTable>
       <apex:pageBlockButtons >
                <apex:commandButton value="Previous" action="{!Previous}" rerender="pgTable,pgBlock"
                                    status="status" disabled="{!DisablePrevious}" />
                <apex:commandButton value="Next" action="{!Next}" reRender="pgTable,pgBlock"
                                    status="status" disabled="{!DisableNext}" />
                <apex:actionStatus id="status" startText="Please Wait..."/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
     <apex:enhancedlist type="Activity" height="800" rowsPerPage="50" customizable="False"/>
</apex:page>
bob_buzzardbob_buzzard
What behaviour do you see?  I wouldn't expect a rerender as you have used an output link which will render a regular anchor tag to link to another page.
JosephJJosephJ
Two pics attached 

1) The 1 pic shows the value entered in search box and clicked on delete

2) the second pic shows no records after particular row deletion , which should not happen and it should render me the table which is not.


User-added image
User-added image

JosephJJosephJ
Any improvements or addition that you would like to mention will be helpful.Thanks .James
bob_buzzardbob_buzzard
The problem here is that when you send the user to the delete action page, you lose the context of the search that the user has carried out.  When they are redirected to the page, its the same as hitting it for the first time.

You can pass the search information around on the URL and execute a search as soon as the page is loaded.  I wrote up a blog post on this a while ago - it should be pretty close to what you are trying to do:

http://bobbuzzard.blogspot.co.uk/2011/06/execute-custom-search-when-opening-page.html
JosephJJosephJ
Hi Bob, I'm not able to access your blog site as some of the sites are blocked for use.:( .. Could you please help me out with my implementation,it will be really helpful for me. Still stucked and pressing my head to see the mistake.
JosephJJosephJ
Ok after spending some time on othe place, i get to see you blog. Actually that is not my requirement. I want that the row to be deleted.

In your blog post ,what is does is it takes me to that particular row/record to edit or create new one . But there is no option of Deleting ???