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
Arun BalaArun Bala 

Using 1 controller for 2 Pages ..

Folks,

Probably a dumb question -- is it a bad practise to use 1 controller for 2 different visualforce pages ? 1 page is a main page & the other is a pop-up from the main page.

 

Pls advise.

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
dchasmandchasman
Not at all - just as long as you are aware of the rules around sharing controller/viewstate between multiple views. In your specific case of a popup there can be some challenges. Can you tell us a bit more about your specific approach to implementing the "popup"?

All Answers

Arun BalaArun Bala
Any tips folks ..
dchasmandchasman
Not at all - just as long as you are aware of the rules around sharing controller/viewstate between multiple views. In your specific case of a popup there can be some challenges. Can you tell us a bit more about your specific approach to implementing the "popup"?
This was selected as the best answer
Arun BalaArun Bala

Hi Doug,

This is what I am supposed to & planning to do ..

 

1. I will have a VF page VF1 with a dataTable inside it.

2. One of the columns(C1) of the dataTable is a commandLink on click of which I need to open a pop-up window (VF2).

3. This pop-up window is a drill down on the details about the column C1. So this VF2 will also contain a data table and some other stuff.

 

I plan to use the same controller for both the pages because for page 2 I will use the data that is initialized(init method) on the controller class for page 1. Hope I am not confusing here :-)

 

I haven't tried such approach before but as you said this should work I guess. Also I dont have any navigation or reference to pages from the pop-up. So I just put some data on the pop-up and will call one action method .. thats about it ...

 

 

Ron HessRon Hess

Here a simple example of implementing a popup using the YUI library.

 

http://wiki.apexdevnet.com/index.php/Visualforce_Popup

 

enjoy.

Arun BalaArun Bala
Wow .. this is a great article .. thanks for sharing this Ron.
Cool_DevloperCool_Devloper

Hello Ron,

 

Seeing your post, i tried implementing YUI for one of my requirements. Here is how it goes- 

 

I am using YUI to open VF pop up screens with a set of values dynamically rendered from the controller with a logic.

 

The problem is that, these values are not updated dynamically as per the requirement whenever the logic is re-run in the controller. I can see the method being executed in the debug log, but the SelectList is not getting refreshed with the new set of values fetched from the controller.

 

I am really clueless as to why is this happening :smileysad:

 

Not sure if i am missing out something or is this a bug with the way YUI works with visualforce pages??

 

Any help will be highly appreciated!!

 

Many Thanks,

Achin