Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DetailFormatter Format not firong on DetialViewerField when SetData() is called

    Using SmartClient Version: v10.0p_2015-02-26/PowerEdition Deployment (built 2015-02-26) in IE 11.

    I have a DynamicForm that contains a CanvasItem that is composed of a DetailViewer. I have defined a DetailViewerFiled on the DetailViewer that has a DetailFormatter.
    Code:
    DetailViewerField pocListFld = new DetailViewerField("ScrumTeamPocs");
    pocListFld.setDetailFormatter(new DetailFormatter(){
        @Override
        public String format(Object value, Record record, DetailViewerField field) {
    System.out.println("In POC formatter");    
            RecordList recs;
            String valueString="";
            if(value!=null && RecordList.isARecordList(value)){
                recs = (RecordList) value;
                for(int x=0 ;x< recs.getLength(); x++){
                    Record rec = recs.get(x);
                    valueString = valueString+rec.toMap().toString();
                }
                return valueString;
            }else{
                return value.toString();
            }
        }
    });
    I am using SetData() on the DetailViewer to set it's record values like this...

    Code:
    Record newValuesRec = new Record(newValuesMap);
    newValuesViewer.setData(new Record[] {newValuesRec});
    The System.out in the formatter is never being executed which leads me to the believe that the formatter is never being called (also the fact that the field is not displaying properly in the DetailViewer).

    Are formatters not applied when setting the data as opposed to fetching it?

    Also...the documentation of the DetailViewerField.setDetailFormatter is non-existent.



    #2
    Formatters are called regardless of how data is populated. Your problem appears to be that the data is not actually making it to the DetailViewer, but you haven't shown enough code to allow anyone to help with that.

    Comment


      #3
      Thank you for your assistance. I was able to find the issue. There was a setDataSource() call happening after the setFields() call on the DetailViewer which was causing the field's formatters to be overwritten.

      Comment

      Working...
      X