You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by andre seame <an...@hotmail.fr> on 2016/04/13 15:01:55 UTC

Expected: 'filterForm:tableWithFilterForm:topToolbars:toolbars:3:headers:3:header:blockh:tf_h'. Found with similar names: 'filterForm:tf_h'

Hello,


The error message is:


Unexpected RuntimeException

Last cause: Unable to find component with id 'tf_h' in [WebMarkupContainer [Component id = blockh]]
        Expected: 'filterForm:tableWithFilterForm:topToolbars:toolbars:3:headers:3:header:blockh:tf_h'.
        Found with similar names: 'filterForm:tf_h'

Markup

The problem is in "file:.../table/HeadersToolbar.html":

             <span wicket:id="blockh">
                    <input wicket:id="tf_h" type="text"/>
              </span>


Here is my code (This is the code of Wicket with patches)



The problem is in "file:../table/HeadersToolbar.html":


<wicket:panel xmlns:wicket="http://wicket.apache.org">
   <tr class="headers">
       <wicket:container wicket:id="headers">
          <th wicket:id="header">
              <span wicket:id="blockh">
                    <input wicket:id="tf_h" type="text"/>
              </span>
              <span wicket:id="container">
                    <span wicket:id="link"></span>
              </span>
          </th>
       </wicket:container>
   </tr>
</wicket:panel>


"file:../WEB-INF/classes/com/thales/orchestra/ivvq/phlof/wicktable/table/HeadersToolbar.java":


@Override

protected void populateItem(Item<IColumn<T, S>> item)
 {   final IColumn<T, S> column = item.getModelObject();

        WebMarkupContainer header = new WebMarkupContainer("header") ;

         MyPanelForSortingAndFiltering ps = (MyPanelForSortingAndFiltering ) column.getHeader("link") ; // On se pose pas de question on impose que tous soit en panelsort

        if (ps.isFiltering()) // Add the filter input
        {   WebMarkupContainer blockh = new WebMarkupContainer("blockh") ;
            header.add(blockh) ;
            TextField<String> tf_h = new TextField<String>("tf_h",ps.getModelHeader()) ;
            blockh.add(tf_h) ;
            ps.getFilterForm().add(tf_h) ;  // For understanding purpose
         }
         else
         {   Label  blockh = new Label("blockh","invisible") ;
             header.add(blockh) ; blockh.setVisible(false) ;
          }


          WebMarkupContainer container = null ;
           if (column.isSortable()) // Add the link to sort
                {  container = newSortableHeader("container", column.getSortProperty(), stateLocator) ; }
                else
                {  container = new WebMarkupContainer("container") ; }
                container.add(new Label("link",ps.getColumnTitle())) ;
                header.add(container) ;

                if (column instanceof IStyledColumn)
                ...

                item.add(header) ;
                item.setRenderBodyOnly(true) ;
    }
} ; // End of RefreshingView headers



With this mechanism a column could sortable or not.


No I am trying to add filtering capabilities: The first step is to add a input zone in the header of the current column. The second step will to send input value to the filter processing.



TEST n°1 : ps.getFilterForm().add(tf_h)


Last cause: Unable to find component with id 'tf_h' in [WebMarkupContainer [Component id = blockh]]
        Expected: 'filterForm:tableWithFilterForm:topToolbars:toolbars:3:headers:3:header:blockh:tf_h'.
        Found with similar names: 'filterForm:tf_h'


If my undstanding is correct, ps.getFilterForm().add(tf_h) need to have a wicket:id like filterForm:tableWithFilterForm:topToolbars:toolbars:3:headers:3:header:blockh:tf_h for the input field. But, the headerToolbar.java/PopulateItem add the input field as a tf_h member of a container.


I don't kown how to resolve this kind of problem.



TEST n°2 : no ps.getFilterForm().add(tf_h)

In this case, the page is on the screen without error. The input field is in the appropriate column.


The processing of the form does nothing:

  *   I have to check that input values are send to the processing of the form,
  *   If yes I imagine that I have to do a "mapping" between input value and filterform. How to do that ?

Thanks,

PHL.