1
0
-1

Hi,

I am trying to implement a multirow form load binder to have custom rows but it doesnt work. The form grid doesnt display my rows.

Is someone already used successfully a multirow form load binder plugin and could explain me how it works?

Please don't answer me with a link to the documentation, it's rather useless...

Thanks,

Olivier

 

public class MyMultiRowLoadBinder extends FormBinder implements FormLoadBinder, FormLoadElementBinder, FormLoadMultiRowElementBinder {

    public FormRowSet load(Element element, String key, FormData formData) {
		String formId = element.getPropertyString("formDefId");
        setProperty("formDefId", formId);
        setProperty("foreignKey", key);
	
        FormRowSet displayedRows;
		displayedRows = ... some computation (I set foreignKey in rows)
        return displayedRows;
    }
}
    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      I do not understand your question. I tried a simple code like below for a form grid:

      import org.joget.apps.form.model.Element;
      import org.joget.apps.form.model.FormData;
      import org.joget.apps.form.model.FormRow;
      import org.joget.apps.form.model.FormRowSet;
      import org.joget.apps.form.service.FormUtil;
      import org.joget.plugin.base.PluginManager;
      import org.joget.apps.form.model.FormLoadBinder;
      public FormRowSet load(Element element, String primaryKey, FormData formData) {
           
          FormRowSet rows = new FormRowSet();
          rows.setMultiRow(true);
          FormRow row = new FormRow();
          row.setProperty("value", "55555");
          row.setProperty("text", "Laugh");
          rows.add(row);
          
          return rows;
      }
       
      //call load method with injected variable
      return load(element, primaryKey, formData);

      The code above works so this is not a Joget problem. I need more information regarding your plugin.

        CommentAdd your comment...
      1.  
        2
        1
        0

        Thanks a lot!

        It was just missing the following line

        rows.setMultiRow(true);

          CommentAdd your comment...