Hi,
I am using an eventLink. I can pass String and other primitive types using
t:context. But I want to pass a whole Object using t:context. I get the
error "Could not find a coercion from type java.lang.String to type
test.ViewUsers". I am using valueEncoder but it is not called.

Here is my tml file

<table width="100%" t:type="grid" t:id="list" t:source="users"
t:row="rowUser" encoder="encoder"

       t:model="beanModel"

        t:add="action"

        t:zone="^"

 >

       <p:actionCell >

       <a t:type="eventLink" t:event="review" t:context="[rowUser]"
href="#" encoder="encoder">

                Testing

       </a>


Here is my Java file. The valueEncoder is not called. The logger.error did
not output anything.

boolean onReview(ViewUsers object) {

        logger.error("Testing. Inside onReview");

         return false;

}

public ValueEncoder<ViewUsers> getEncoder()

{

        return new ValueEncoder<ViewUsers>()

        {

         @Override

          public String toClient(ViewUsers user)

           {

                    logger.error("Testing. Inside toClient");

                    if(user == null)

                    {

                          return null;

                    }

                  return user.getId().toString();

             }

            @Override

            public ViewUsers toValue(String clientValue)

           {

                   logger.error("Testing. Inside toValue");

                  for(ViewUsers user : users)

                  {

                        if(user.getId().toString().equals(clientValue))

                        {

                                return user;

                         }

                     }

                   return null;

              }

          };

     }


Any help would be appreciated. Thanks.

Reply via email to