You need to sign in to do that
Don't have an account?
JosephJ
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')}">
<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')}">
<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>
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')}">
<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')}">
<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>
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.
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
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 ???