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


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

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.

public void 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

1 follower



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

Seen: 20 times

Last updated: Feb 10 '16

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