0

So, I have an apex:pageBlockTable generated off of an sObject. Take the following table for example:

A1 | B1 | C1
A2 | B2 | C2
A3 | B3 | C3

Let us assume that I have an apex:outputPanel that is rendered IF the contents of the cell contain 'C', so the outputPanel would be rendered for the last column in the above table.

Then I have some dynamic input field / button on the page that changes the value of one of the cells:

A1 | B1 | C1
A2 | C# | C2
A3 | B3 | C3

I now need to rerender the cell that was previously B2 but now is C# so that I can not only get "C#" to show up but also so that any scripts that execute based on the value in the cell can also execute (i.e. any outputpanels will be recalculated).

Here are the issues: I cannot dynamically assign IDs, so I cannot set the IDs to "row_num - column_num" for example. This means I cannot rerender the cell specifically. Yet I do not want to rerender the entire table, too many SOQL queries are involved in building the table, and it would take too long. I also do not want to rerender the columns or rows because of similar reasons.

TL;DR Assuming that each of the cells of the table CAN be rerendered without running into the problems mentioned above, how would I go about dynamically assigning IDs to each of the cells so that I can rerender a specific cell? Is there a commonly accepted workaround to do something like this?

  • 1
    I think you're going to have to roll your own html+javascript if you want that level of granularity. For instance, angular is really good at exactly this sort of DOM control. – Adrian Larson Dec 20 '16 at 21:14
  • Do you know of any good links to learn how to integrate Angular and Visualforce? – Konnor McDowell Dec 20 '16 at 21:26
  • There's nothing special about Visualforce in this regard. Just note the learning curve for angular in particular is quite steep. The results are awesome but you have to be careful. – Adrian Larson Dec 20 '16 at 21:28
  • Alternatively, you might start learning Lightning, as components are more amiable to what you're trying to do (and runs far faster than vanilla Visualforce could hope to accomplish). – sfdcfox Dec 20 '16 at 21:47
  • In terms of usability would you recommend Angular or Lightning? I'm assuming Angular is more universal? – Konnor McDowell Dec 20 '16 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.