[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Own client component with multiple dirty fields  XML
Forum Index -> Development
Author Message
tbredehoeft

Active

Joined: 26/09/2014 14:02:53
Messages: 22
Offline

Hi,

we're currently developing an own client component and are now looking at how we can communicate data from client to server. The problem is that our main PageElement-class needs to submit multiple dirty fields at one time to the Server. Within the controlattributeusage-XML I can only define one Input-attribute per Tag. Of course I could define a custom data structure and serialize it, that way the one Input-field would be sufficient, but is there a better way?

Thanks in advance!
Admin

Power User

Joined: 21/11/2007 11:36:10
Messages: 37
Offline

Hi,
by default you register dirty values on the client side by calling something like:

registerDirtyInformation(getId(),nowContent,byFlush,true,null,false);

But you can also add additional values in the following way:

registerDirtyInformation(getId()+".harry",nowContent,byFlush,true,null,false);

Only exception: do not use appendices with ".action*" because this is how action events are transferred.

You now need to tell the server side processing that there are additional values to be passed. The most simple way is to just tell the CaptainCasa processing in the component class on server side by overriding the method "appendDecodeInformation". We do it internally e.g. with the SMARTTEXTAREA component, where in addition to the text the cursor position is transferred:

Code:
 public class SMARTTEXTAREAComponent 
     extends BaseActionComponent
 {
 
     @Override
     protected void appendDecodeInformation(List<DecodePassData> decodeInfos)
     {
         super.appendDecodeInformation(decodeInfos);
         decodeInfos.add(new DecodePassData(".textselectioninfo","textselectioninfo"));
     }
     
 }


The first parameter of DecodePassData is the "appendix" that you add from your client side component. THe second is the tag-attribute name of the component.

Regards, Björn
tbredehoeft

Active

Joined: 26/09/2014 14:02:53
Messages: 22
Offline

Thanks for the explanation, that's a nice solution!
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team