0

How to access the default rowRenderer of a grid?

asked 2016-02-09 14:12:34 +0800

WilliamB gravatar image WilliamB
1609 1 6

updated 2016-02-09 14:25:40 +0800

I've a custom grid and I'm using zul to define its column and row composition. I just want to be able to access the row renderer so that if a custom attribut is set to True, I will add a checkbox in front of the row.

When I get the Row in afterCompose they have not yet been rendered, so adding the checkbox then doesn't work.

I tried getting the default renderer but getRowRenderer() return null if the default is used. My idea was to add a wrapper renderer and on its render method add a checkbox to the row before calling the default renderer render method.

And everything is package or private, so annoying =/

Does anyone has an idea how to do that?

=> I want to add checkbox in front of row dynamicaly when a custom attribut of my grid is set to true while still using zul to define my grid layout.

delete flag offensive retag edit

Comments

mvvm and template tag used?

chillworld ( 2016-02-09 14:26:38 +0800 )edit

I wanted to avoid impacting the zul / template of the grid.

WilliamB ( 2016-02-10 09:23:45 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-02-10 09:24:36 +0800

WilliamB gravatar image WilliamB
1609 1 6

Went with overriding the onInitRender method, was fairly simple in the end.

@Override
public void onInitRender() {
    super.onInitRender();
    if (withCheckbox) {
        for (Component row : getRows().getChildren()) {
            Checkbox checkbox = new Checkbox();
            row.insertBefore(checkbox, row.getFirstChild());
        }
    }
}
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2016-02-09 14:12:34 +0800

Seen: 21 times

Last updated: Feb 10 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More