Hey Sudhir,

yes, this stuff doesn't seem to be documented, and it takes some
ingenuity to wrap this functionality centrally without doing manual
updates all over the place. I've started to move towards factories for
my widgets, that way I can have a central class that provides nicely
configured widgets.

Daniel



On Jul 15, 10:53 pm, "Java geek" <develo...@jsptube.com> wrote:
> Thanks Daniel,
> This is exactly what I was looking for. I felt that there should be some way
> other than extending the widgets, but din't know what.
>
> Thanks
> SN
>
> ----- Original Message -----
> From: "Richtermeister" <nex...@gmail.com>
> To: "symfony users" <symfony-users@googlegroups.com>
> Sent: Wednesday, July 15, 2009 10:11 PM
> Subject: [symfony-users] Re: Custom rendering of widgets
>
> Hey Sudhir,
>
> the settings you're looking for is the "formatter" option in the
> sfWidgetFormSelectCheckbox class.
> You can pass this option a callable that will handle the formatting of
> the checkbox output. Ideally, as you found, you do this by extending
> the class and putting the custom formatting inside, but you don't have
> do to this. You could also call $form["checkboxes"] -> getWidget() ->
> setOption("formatter", array("Customclass", "customMethod"));
>
> There may be a way to manage this centrally as well.. look at the
> sfViewableFormPlugin for inspiration..
>
> Have a great day,
> Daniel
>
> On Jul 15, 12:49 am, "Java geek" <develo...@jsptube.com> wrote:
> > Ok, now I know there's no other solution, other then extending the core
> > widgets. However, I believe this is a serious limitation, that coluld be
> > over come by adding some flexibility in the core widgets.
>
> > I believe, Never hardcode, any sort of markup in your code.
>
> > Here's my suggestion, that could be borrowed from a great Java web
> > framework called Webwork (which is now merged into struts 2)
>
> > It also have similar components like symfony form widgets, its called tags
> > in webwork.
>
> > How it handles rendering of this tags -
> > There are widget templates (say some thing like out partials) that know
> > how to render a widget.
> > Widget it self does not know how to render the markup, it pass over this
> > job to template. Whenever any widget needs to be rendered, the template is
> > automatically loaded, passing it all the data required to render the
> > widgets markup, and template knows how to render it. There are default
> > templates for all the widgets. If u want custom one, Just have your own
> > tempalte in classpath or specify it in config files and it will be loaded
> > automatically and will handle rendering, This is seperation of
> > responsibility. There are templates for generating HTML, XHTML and AJAX.
>
> > You can generate virtually any sort of markup with your own templates.
> > Widgets are no longer bound to generate HTML only.
>
> > We already have most of the groundwork in symfony, required to implement
> > these. Autoloading !!
>
> > Reference:http://opensymphony.com/webworkhttp://wiki.opensymphony.com/display/W...
>
> > Thanks
> > SN
>
> > ----- Original Message -----
> > From: Java geek
> > To: symfony-users@googlegroups.com
> > Sent: Wednesday, July 15, 2009 12:21 PM
> > Subject: [symfony-users] Custom rendering of widgets
>
> > I want custom rendering of sfWidgetFormSelectCheckbox and
> > sfWidgetFormSelectRadio widgets
>
> > I don't want the default <ul> and <li> tags. I want divs instead and will
> > need different tags on different screens.
>
> > I know there's a solution, extend these widgets and provide custom
> > formatter() method.
>
> > But I think, this isn't a solution, and I feel there should be some other
> > way to hook the custom formatting, I am not sure though.
>
> > I don't want to extend them just to have different rendering.
> > This is a very common task, one may need many different rendering of these
> > widgets on different screens. Does that mean he will have to extend these
> > widgets for each, and have five radio widgets for five different screens?
>
> > This way I will endup extending those widgets many time, adding no extra
> > functionality other than rendering.
>
> > Is there any other way!
>
> > Thanks
> > Sudhir
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to