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
sparkysparky 

rerender one part of a pageBlockTable?

Is it possible, using one of the action components like actionFunction or actionSupport, to rerender just one piece of a table? (in this case a pageBlockTable)

 

My table is listing Leads.  (Leads contained in a wrapper obj defined in the controller, to be exact.)  One of the columns contains a select control (so we've got a separate select control for each row).  When onchange fires for the select, I'd like to rerender the contents of another column in the same row.  Or it would be OK to rerender the entire other column.  But I don't want to rerender the whole table, or the whole row.

 

I don't seem to be able to do this.  If I put the column id in the rerender attribute, nothing seems to happen.  Same if I use the id of the outputPanel that's contained inside that column (which would be repeated for each row, so not sure how to refer to the outputPanel contained in a particular row.)

 

Is this possible?  Or is it only possible to refresh the table as a whole?

 

Thanks much!

sparkysparky

Here's some simplified code in case that helps.  From the page:

 

 

<apex:pageBlockTable id="ldtbl" value="{!results}" var="l" style="margin-bottom:20px">
<apex:column id="calistcol" headerValue="Contact/Account">
<apex:selectList id="clist" value="{!l.lead.Contact_Preview__c}" multiselect="false" size="1">
<apex:selectOptions value="{!l.matches}" />
<apex:actionSupport event="onchange" rerender="previewCol" action="{!doNothing}"/>
</apex:selectList><br />
</apex:column>

<apex:column id="previewCol">
<apex:outputPanel id="previewLinks">
<apex:outputPanel >
preview:&nbsp; <apex:outputField id="conPreview" value="{!l.lead.Contact_Preview__c}" />
<BR/>
test:<apex:outputText value="{!l.lead.Contact_Preview__c}" />
</apex:outputPanel>
</apex:outputPanel>
</apex:column>
</apex:pageBlockTable>

 

 As you can see, I'm trying this with ActionSupport, but I also tried with ActionFunction.

 

The controller is too complex to post here, but here's a few details:

* the method getresults returns a list of wrapper objects which each contain a lead (which is why we use l.lead. notation in places)

* the method doNothing really does nothing - I only included this b/c I read in a thread here that sometimes rerenders don't work on an actionSupport unless there's an action specified

* Contact_Preview__c is a custom Lead field, lookup field to Contact

* The value chosen by the selectList will be a contact ID

* What I'm shooting for is for the outputField "conPreview" to be updated to it will display a link to the contact chosen in the selectList, allowing both for click through or a hover preview

 

Current behavior:

* in Firefox, nothing happens - the preview column does not update at all.

* in Google Chrome, the contents of the preview column disappear, and the javascript console shows an error - Uncaught Error: NOT_SUPPORTED_ERR: DOM Exception 9 https://c.cs3.visual.force.com/faces/a4j_3_1_4-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript (line 46)

 

Perhaps I'm missing something basic here? 

Message Edited by sparky on 04-08-2009 12:54 AM
iceberg4uiceberg4u
Have you tried putting an outputPanel in there.It says so in the documentation.Just a guess!!
Ron HessRon Hess

i don't think you can do a partial page refresh on a portion of a table.  

it may work for the contents of a cell in a table, and will work for the entire table, but not for a row or column.

sparkysparky
One cell would be fine.  How do you do that?
sparkysparky

Bump.  Still hoping for some more help on this one.

 

Ron?  Anyone?

 

Thanks much!

M.

Ron HessRon Hess
you would put an output panel inside a cell, give it an ID, then try to rerender that component.  I think it would work, not positive.
sparkysparky

Yeah, I've tried that already.  Not sure I'm doing it right.  But as my original post says:

 

"I don't seem to be able to do this.  If I put the column id in the rerender attribute, nothing seems to happen.  Same if I use the id of the outputPanel that's contained inside that column (which would be repeated for each row, so not sure how to refer to the outputPanel contained in a particular row.)"

 

I do wonder how to refer to an element by Id if that element and Id are repeated.

 

 

TanejaTaneja
@sparky: I know it's been 5 yrs, but did you find a solution to the same? I want to render a cell value depending upon the value chosen in previous column but same row.

Any ideas how to achieve that? Any JS or jQuery solutions are also welcome.
Bard09Bard09

@sparky or @Taneja, did either of you figure this out?  Same problem here.  I really don't want to have to rebuild my elegant VF pageblocktable with repeat tags and tons of javascript.

I'm willing to get into the realm of the janky workaround to solve this.