private void buildFooterButtons() {

    FooterCell cell = footer.getCell("clientName");

    HorizontalLayout btnLayout = new HorizontalLayout();
    btnLayout.setSpacing(true);

    Button exportBtn = new Button("Export");
    exportBtn.addStyleName(ValoTheme.BUTTON_TINY);
    exportBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    exportBtn.setIcon(FontAwesome.FILE_EXCEL_O);

    Button refreshBtn = new Button("Refresh");
    refreshBtn.addStyleName(ValoTheme.BUTTON_TINY);
    refreshBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    refreshBtn.setIcon(FontAwesome.REFRESH);

    refreshBtn.addClickListener(
        new Button.ClickListener() {

          private static final long serialVersionUID = 1L;

          @Override
          public void buttonClick(ClickEvent event) {

            queryAndRefresh(
                PerisaiUtil.convertDateToString(today, dtFormat),
                PerisaiUtil.convertDateToString(tmrw, dtFormat));
          }
        });

    // btnLayout.addComponent(exportBtn);
    // btnLayout.addComponent(refreshBtn);
    cell.setComponent(btnLayout);
  }
  private void buildGrid() {

    // disable and change for ES Search

    Query query =
        this.buildESQuery(
            PerisaiUtil.convertDateToString(today, dtFormat),
            PerisaiUtil.convertDateToString(tmrw, dtFormat));
    List<EventThreatBean> list = this.getThreatsFromES(query);

    /*
    List<EventThreatBean> list = PerisaikonsolUI.getEventsDataProvider()
    		.getThreatEvents(PerisaiUtil.convertDateToString(today, dtFormat),
    				PerisaiUtil.convertDateToString(tmrw, dtFormat),groups);*/

    System.out.println("Total Events " + list.size());

    final BeanItemContainer<EventThreatBean> ds =
        new BeanItemContainer<EventThreatBean>(EventThreatBean.class, list);
    setCaption("Total events " + list.size());
    setContainerDataSource(ds);
    setImmediate(true);

    /*if(list.size()<7){
    	this.setHeightMode(HeightMode.ROW);
    	this.setHeightByRows(list.size());
    }*/

    setSizeFull();
    filterRow = appendHeaderRow();

    HeaderCell dateCell = filterRow.getCell("created");
    dateCell.setComponent(buildDateFilter());

    removeColumn("clientId");
    removeColumn("threatId");
    removeColumn("scanCode");

    setFrozenColumnCount(4);

    styleHeaders();

    setColumnOrder(
        "groupName",
        "clientName",
        "userName",
        "perisaiVersion",
        "created",
        "threatName",
        "fileName",
        "threatType",
        "threatLevel",
        "threatOperatingSystem",
        "actionTaken",
        "threatDescription");
    this.getColumn("fileName").setWidth(300);
    this.getColumn("threatDescription").setWidth(500);

    footer = appendFooterRow();
    footer.join(
        "groupName",
        "clientName",
        "userName",
        "perisaiVersion",
        "created",
        "threatName",
        "threatDescription",
        "fileName",
        "threatType",
        "threatLevel",
        "threatOperatingSystem",
        "actionTaken");

    // this.getColumn("created").setHeaderCaption("Event Date");

    buildFilters();

    buildFooterButtons();
  }