Skip to Content
avatar image
Former Member

Problem with TableFilter after adding new node into table datasource.

Hello Experts,

Using NWDS 7.0.18

I implemented the TableFilter utility and had 3 context nodes as such for it (standard implementation)

FilterNode

SourceNode

TableNode

Now I added a drop down by index as the first column to the table, so now my Table node looks like this

TableNode
   DDBINode
      ddbiattr
   tableattr1
   tableattr2

The DDBINode is non-singleton so that each selected value in the table row acts independent. I had this node outside under the root Context and then whenever I selected a value, all the rows in the table would get populated with the same value. So I moved it inside TableNode.

But now when the TableFilter method gets called under wdDoModifyView under the firstTime condition I get the following runtime exception:

 java.lang.IllegalArgumentException: attributeInfo must not be null 

    at com.sjm.wdp.utils.TableFilter$NodeElementByAttributeComparator.<init>(TableFilter.java:839)
    at com.sjm.wdp.utils.TableFilter$NodeElementByAttributeComparator.<init>(TableFilter.java:829)
    at com.sjm.wdp.utils.TableFilter.setFiltersForColumns(TableFilter.java:160)
    at com.sjm.wdp.utils.TableFilter.init(TableFilter.java:91)
    at com.sjm.wdp.utils.TableFilter.<init>(TableFilter.java:59)

Please help!!

Marshall.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    May 12, 2009 at 07:36 PM

    What happens exactly at line TableFilter.java:839?

    Armin

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I suppose I should try and make it a bit more clearer of what I'm doing and what's going wrong where.

      I had 4 context nodes as follows under the root context

      FilterNode

      SourceNode

      TableNode

      DDBINode

      In my view, I created a table and bound it to the TableNode in the context.

      Each table columns filterValue is bound to its corresponding FilterNode.attr.

      The SourceNode contains all the tables original data.

      DDBINode contains one attribute of type string that holds the possible drop down values.

      The first column in the table is a DropDownByIndex UI that was bound to DDBINode.text

      The TableFilter and everything else worked fine except when I changed the drop down value, every single row in the table changed to that drop down value.

      After doing some research, to fix this issue I found that DDBINode should be nested under TableNode and its singleton property should be set to false. After doing this, the call in wdDoModifyView failed:

      wdContext.currentContextElement().setTableFilter( new
      	TableFilter(table, wdThis.wdGetFilterAction(), wdContext.nodeSourceCustProds(), new Hashtable()));
      

      In the actual TableFilter.java file, it fails here:

      First this is called in setFiltersForColumns

      if (attributeSource.containsKey(attributeName))
      	attributeInfo = (String) attributeSource.get(attributeName);
      elementComparator =
      	new NodeElementByAttributeComparator( // call to this constructor fails
      	attributeInfo,
      	column,
      	comparator);
      filterForColumn.put(attributeName, elementComparator);
      

      Then inside that constructor the exception is thrown

      public final class NodeElementByAttributeComparator
      {
      	public NodeElementByAttributeComparator(
      		String attributeInfo,
      		IWDTableColumn column,
      		Comparator comparator)
      	{
      		this(attributeInfo, column, comparator, false, new ArrayList());
      	}
      	private NodeElementByAttributeComparator(
      		String attributeInfo,
      		IWDTableColumn column,
      		Comparator comparator,
      		boolean compareAsText,
      		Collection subNodes)
      	{
      		if (attributeInfo == null)  //////// This is the last bit where is dies
      			throw new IllegalArgumentException("attributeInfo must not be null");
      		if (column == null)
      			throw new IllegalArgumentException("Column  must not be null");
      	}
      }
      

      Please help me out! do I need to extend the TableFilter class in anyway? If so, how?

      Is there an alternative better solution?

      Marshall.

  • avatar image
    Former Member
    Jul 02, 2009 at 02:19 PM

    Solved

    Add comment
    10|10000 characters needed characters exceeded