Trigger subform subtotal field calculation

評論

6 條評論

  • Avatar
    sysberry GmbH

    Hi Andreas,

    the problem can be indeed in the change event. After adding new row there will be a load event on the new row. Perhaps you should manually trigger the formulas with JS.

    P.S. are you from germany? Would be nice to speak more over LinkedIn or XING.

    Regards,
    Alexey

    0
    評論操作 永久連結
  • Avatar
    Andreas Blersch

    The formula calculation is working, but not the sum of the subtotal field from the subform.

    0
    評論操作 永久連結
  • Avatar
    sysberry GmbH

    If you set the valie with a rule, then the change event is not triggered, correct. For that you will need to write small JS to trigger the change event, or to calculate fields.

    Regards,
    Alexey

    0
    評論操作 永久連結
  • Avatar
    Andreas Blersch

    In the rules of the formula field i add following svript to fire the onchange event after the data are set to "curPlankosten" (last field in the image)

     

    $('#curPlankosten').change();

    But it is not working.

     

    0
    評論操作 永久連結
  • Avatar
    sysberry GmbH

    Hi Andreas,

     

    Plankosten are inside the subform. If you inspect the field in preview mode, you will see, that because of the subform there is a guid after the id, so only "#curPlankosten" will not work. You will need to find the right id, or for example give an additional css class to the field and then search on class name. 

    Regards,

    Alexey

    0
    評論操作 永久連結
  • Avatar
    Andreas Blersch

    ok got it

     

    function GetSubFormControlAndFireChange(ctrl) {
      var control = $(ctrl).parents(".subFormContentRowChildWrapper").find("[id^='curPlankosten']");
      control.change();
    }

    0
    評論操作 永久連結

登入寫評論。