In my forms, I’m using my own field (standard form field with additional button next to it). This fields opens up a CJuiDialog (after clicking that button). Currently I’m generating partial view (that contains CJuiDialog declaration, contents and necessary JS code) in a view, where I use that field. I call renderPartial before calling function to draw field.
I would like to change it to have call for drawing field also handle rendering necessary sub-view.
Question, is this a good idea? And, how to control, if there are not more than one dialog rendered (i.e. if two fields of the same kind in the same form, all should use the same, one dialog). Is there any way to have some kind of "stack" of sub-views, "register" them for rendering (just as we do with scripts) and render all of them at once, controlling that, if any particular view is put into that "stack" twice or more, to render it once (exactly as with scripts)?
Do we have any tools in framework for such functionally? If not – would that be much work to do it myself? And is it worth doing so?
What do you think?