grid is null in doAfterCompose

asked 2014-09-21 14:01:48 +0800

MohanSharma2909 gravatar image MohanSharma2909
1 1

updated 2014-09-21 14:12:58 +0800

This is my templateWestCollapsible.zul

 <borderlayout id="templateBorderlayout"  
  <center id="center" autoscroll="false">

    <east collapsible="true" title="Help" size="15%" open="false"
                         sclass="z-borderlayout-icon z-east-exp">

    <west size="15%">
        <include id="westMenu" src="westMenu.zul"/>

This is my westMenu.zul

<window border="normal"  apply= org.test.view.ManageScheduleComposer">
    <caption label="Quick Links"></caption>
    <groupbox mold="3d" width="100%" closable="false"
        <vbox hflex="1">
            <toolbarbutton id="schedule" label="schedules"/>

I have a class which takes the id and generates the view on the center layout

This is my schedule.zul

<window id="win" vflex="1" hflex="1" border =""
        <grid  mold="paging" pageSize="10" id="dataGrid" hflex="1"
                         emptyMessage="Nothing to display">
                <column label="Description"></column>
                <column label="From Date"></column>
                <column label="To Date"></column>
                <column label="Status"></column>
                <column  width ="5%"></column>
                <column label="Action"></column>
            <rows id="scheduleRows">
                <row self="@{each='manageSchedule'}"
                    <label value="@{manageSchedule.description}"></label>
                    <label value="@{manageSchedule.fromDate}"></label>
                    <label value="@{manageSchedule.toDate}"></label>
                    <label  value="@{manageSchedule.status}"></label>
                    <label  value="@{manageSchedule.id}"
                    <button label="Release">

My problem is inside the Composer class the grid is coming as null if the load the templateWestCollapsible.zul but if I load the schedule.zul directly the grid is not null then this is my composer

public class ManageScheduleComposer extends SelectorComposer<Component> {

private Rows scheduleRows;

private Grid dataGrid;

private ListModelList<ScheduleDto> allSchedulesList;
List<ScheduleDto> list = new ArrayList<>();

public ManageScheduleComposer(){
    list.add(new ScheduleDto("1",new LocalDate(2014,9,01), new LocalDate(2014,9,30),"Sept",""));
    list.add(new ScheduleDto("2",new LocalDate(2014,10,01), new LocalDate(2014,10,30),"Oct",""));
    list.add(new ScheduleDto("3",new LocalDate(2014,11,01), new LocalDate(2014,11,30),"Nov",""));

public ListModelList<ScheduleDto> getAllSchedulesList() {
    return allSchedulesList;

public void setAllSchedulesList(ListModelList<ScheduleDto> allSchedulesList) {
    this.allSchedulesList = allSchedulesList;

public void doAfterCompose(Component comp) throws Exception {
    setAllSchedulesList(new ListModelList<ScheduleDto>(list));
    dataGrid.setModel(getAllSchedulesList());// dataGrid is null why?
delete flag offensive retag edit


1 Answer

Sort by ยป oldest newest most voted

answered 2014-09-21 17:32:11 +0800

Darksu gravatar image Darksu
1991 1 4

Hello MohanSharma2909,

From your description, and the provided code, it is logic that the grid is null because it's supposed to get the reference from the zul page (In this case the grid has not been defined).

Perhaps you could create separate composers?

Best Regards,


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: 2014-09-21 14:01:48 +0800

Seen: 22 times

Last updated: Sep 22 '14

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