You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Vjeran Marcinko (JIRA)" <ji...@apache.org> on 2009/06/20 07:50:07 UTC

[jira] Created: (TAP5-754) Introduce easier way to disable column sorting in Grid

Introduce easier way to disable column sorting in Grid
------------------------------------------------------

                 Key: TAP5-754
                 URL: https://issues.apache.org/jira/browse/TAP5-754
             Project: Tapestry 5
          Issue Type: Improvement
    Affects Versions: 5.1.0.5
            Reporter: Vjeran Marcinko


I have seldom need for Grid sorting so I almost always turn it off. Currently this is a bit awkward procedure. I also rarely configure Grid with BeanModel created in my  page class, because template way of configuring Grid is sufficient for me.
I have to introduce 3 new objects just for this purpose in this class, and also do some coding in setupRender():

    @Property
    private BeanModel model;
    @Inject
    private BeanModelSource beanModelSource;
    @Inject
    private ComponentResources componentResources;

    void setupRender() {
        ....
        model = beanModelSource.createDisplayModel(Employee.class, componentResources.getMessages());
        List<String> propertyNames = model.getPropertyNames();
        for (String propertyName : propertyNames) {
            model.get(propertyName).sortable(false);
        }
    }

Tapestry 4 had simple way of using character "!" in template that achieved the same thing so I feel kinda nostalgic for it...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TAP5-754) Introduce easier way to disable column sorting in Grid

Posted by "Oleg Smirsky (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756746#action_12756746 ] 

Oleg Smirsky commented on TAP5-754:
-----------------------------------

I would like to extend the original request - make "dataModel" of the Grid easily accessible in subclasses. Solution above requires replacing the class in the application (put my own copy of Grid class in org.tapestry....). I'm trying to achieve both no sorting and some other fancy manipulations with BeanModel - it is very painful.

My proposal:
Provide some hook between setting Grid.model parameter (from page or from defaultModel()) and using this parameter in getDataModel
Currently I can create BeanModel for Grid.model and do some modifications in the page. But I can't do those modifications in the plain subclass. Probably I could wrap Grid in another component with TML template, but that's too much work. And the issue is common for all component parameters IMO - you can't provide initialization method in subclass of the component (if I'm wrong, educate me).

Current issues are:
- getDataModel does some initialization and I want to modify that initialization part
- I can't override getDataModel completely (=not to call super.getDataModel()), because properties like model, dataModel, add, include, exclude etc. are private
- I can't override getDataModel, call super.getDataModel and do additional initialization, because it is too late in the process

> Introduce easier way to disable column sorting in Grid
> ------------------------------------------------------
>
>                 Key: TAP5-754
>                 URL: https://issues.apache.org/jira/browse/TAP5-754
>             Project: Tapestry 5
>          Issue Type: Improvement
>    Affects Versions: 5.1.0.5
>            Reporter: Vjeran Marcinko
>
> I have seldom need for Grid sorting so I almost always turn it off. Currently this is a bit awkward procedure. I also rarely configure Grid with BeanModel created in my  page class, because template way of configuring Grid is sufficient for me.
> I have to introduce 3 new objects just for this purpose in this class, and also do some coding in setupRender():
>     @Property
>     private BeanModel model;
>     @Inject
>     private BeanModelSource beanModelSource;
>     @Inject
>     private ComponentResources componentResources;
>     void setupRender() {
>         ....
>         model = beanModelSource.createDisplayModel(Employee.class, componentResources.getMessages());
>         List<String> propertyNames = model.getPropertyNames();
>         for (String propertyName : propertyNames) {
>             model.get(propertyName).sortable(false);
>         }
>     }
> Tapestry 4 had simple way of using character "!" in template that achieved the same thing so I feel kinda nostalgic for it...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TAP5-754) Introduce easier way to disable column sorting in Grid

Posted by "Oleg Smirsky (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756746#action_12756746 ] 

Oleg Smirsky commented on TAP5-754:
-----------------------------------

I would like to extend the original request - make "dataModel" of the Grid easily accessible in subclasses. Solution above requires replacing the class in the application (put my own copy of Grid class in org.tapestry....). I'm trying to achieve both no sorting and some other fancy manipulations with BeanModel - it is very painful.

My proposal:
Provide some hook between setting Grid.model parameter (from page or from defaultModel()) and using this parameter in getDataModel
Currently I can create BeanModel for Grid.model and do some modifications in the page. But I can't do those modifications in the plain subclass. Probably I could wrap Grid in another component with TML template, but that's too much work. And the issue is common for all component parameters IMO - you can't provide initialization method in subclass of the component (if I'm wrong, educate me).

Current issues are:
- getDataModel does some initialization and I want to modify that initialization part
- I can't override getDataModel completely (=not to call super.getDataModel()), because properties like model, dataModel, add, include, exclude etc. are private
- I can't override getDataModel, call super.getDataModel and do additional initialization, because it is too late in the process

> Introduce easier way to disable column sorting in Grid
> ------------------------------------------------------
>
>                 Key: TAP5-754
>                 URL: https://issues.apache.org/jira/browse/TAP5-754
>             Project: Tapestry 5
>          Issue Type: Improvement
>    Affects Versions: 5.1.0.5
>            Reporter: Vjeran Marcinko
>
> I have seldom need for Grid sorting so I almost always turn it off. Currently this is a bit awkward procedure. I also rarely configure Grid with BeanModel created in my  page class, because template way of configuring Grid is sufficient for me.
> I have to introduce 3 new objects just for this purpose in this class, and also do some coding in setupRender():
>     @Property
>     private BeanModel model;
>     @Inject
>     private BeanModelSource beanModelSource;
>     @Inject
>     private ComponentResources componentResources;
>     void setupRender() {
>         ....
>         model = beanModelSource.createDisplayModel(Employee.class, componentResources.getMessages());
>         List<String> propertyNames = model.getPropertyNames();
>         for (String propertyName : propertyNames) {
>             model.get(propertyName).sortable(false);
>         }
>     }
> Tapestry 4 had simple way of using character "!" in template that achieved the same thing so I feel kinda nostalgic for it...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.