Christian A.
Christian A.

Reputation: 157

Adding a view with pager to a Xpage by using JSF

I have tryed to build a Java Class in JSf witch adds a view with a Pager to an XPage Im Using a UiDataview in this simple example but my problem is that the Pager witch is added to the result is never displayed in my Xpage. anyone an idea what i have to do?

    public class MainLibcontrol extends UIComponentBase implements FacesComponent {

        private static final String RENDERER_TYPE = "de.my.MainLibcontrol";
        private static final String COMPONENT_FAMILY = "de.my";

        public MainLibcontrol() {
            setRendererType(RENDERER_TYPE);
        }

        @Override
        public String getFamily() {
            return COMPONENT_FAMILY;
        }

        @SuppressWarnings("unchecked")
        public void initBeforeContents(FacesContext arg0) throws FacesException {
            try {
            UIDataView viewtable = new UIDataView();
            viewtable.setColumnTitles(true);
            CategoryColumn categoryColumn = new CategoryColumn();
            categoryColumn.setComponent(viewtable);
            categoryColumn.setColumnName("form");
            categoryColumn.setColumnTitle("form");
            categoryColumn.setContentType("text");
            viewtable.addCategoryColumn(categoryColumn);

            DominoViewData data = new DominoViewData();
            data.setComponent(viewtable);
            data.setViewName("142342");
            data.setVar("view2");
            viewtable.setData(data);
            viewtable.setId("dataView1");
            viewtable.setRows(3);
            SummaryColumn summaryColumn = new SummaryColumn();
            summaryColumn.setComponent(viewtable);
            summaryColumn.setColumnName("5");
            summaryColumn.setColumnTitle("5");
            viewtable.setSummaryColumn(summaryColumn);


            XspPager pager = new XspPager();
            pager.setPartialRefresh(true);
            pager.setLayout("Previous Group Next");
            pager.setId("pager1");

            viewtable.getChildren().add(pager);

            this.getChildren().add(viewtable);
            } catch (Exception e) {
                e.printStackTrace();

            }
        }
        public void buildContents(FacesContext arg0, FacesComponentBuilder arg1) throws FacesException {
                .....
        }

        public void initAfterContents(FacesContext arg0) throws FacesException {
            ....
        }

    }

Upvotes: 0

Views: 188

Answers (1)

Toby Samples
Toby Samples

Reputation: 2178

I haven't tried this out, but I would imagine you want to add it as a facet of the viewTable not as a child.

so your line should be

viewtable.getFacets().put("headerPager", pager);

Upvotes: 1

Related Questions