Embedded text input not updating text, not triggering event

I have Text input filed which is embedded. On this embedded view onchange script is bound to value parameter. But when I change value parameter using python the embedded view is not refreshed and onchange script is not fired even though in logs it shows that value has been updated. What am I doing wrong ? When I manually fill some characters to the text field everything works.

did you mark the view param(in the embedded view) as input + output?

(highlighted one)
image

I found that on change scripts don’t fire on params. I bind value to custom props. Maybe victor’s way works too?

They definitly fire on params for me usually, tho idk about this particular case

Maybe it was just on initial passing of the params when the component loads? 🤷

You also ofc have to make the binding to the param bidirectional xd
but its def working for me

one step closer - I bind text property of text input to the param and text is updating but onchange is not firing

is the binding bidirectional?
is the viewparam bidirectional?

{
  "custom": {
    "ArticleID": 0
  },
  "events": {
    "system": {
      "onStartup": {
        "config": {
          "script": "\tlogger\u003dsystem.util.logger(\u0027StartupEvent_Item_New\u0027)\n\tlogger.info(\u0027fired\u0027)\n\t\n\tself.getChild(\"root\").Init()\n\t"
        },
        "scope": "G",
        "type": "script"
      }
    }
  },
  "params": {
    "ProductionID": 0,
    "WorkListId": 0,
    "initEmbededView": "Page/Item_BOM",
    "machineID": ""
  },
  "propConfig": {
    "custom.ArticleID": {
      "binding": {
        "config": {
          "parameters": {
            "ProductionOrderId": "{view.params.ProductionID}"
          },
          "queryPath": "SpringInsertion/Article",
          "returnFormat": "scalar"
        },
        "type": "query"
      },
      "persistent": true
    },
    "params.ProductionID": {
      "paramDirection": "inout",
      "persistent": true
    },
    "params.WorkListId": {
      "paramDirection": "input",
      "persistent": true
    },
    "params.initEmbededView": {
      "paramDirection": "input",
      "persistent": true
    },
    "params.machineID": {
      "paramDirection": "input",
      "persistent": true
    }
  },
  "props": {
    "defaultSize": {
      "height": 672
    }
  },
  "root": {
    "children": [
      {
        "children": [
          {
            "events": {
              "component": {
                "onActionPerformed": {
                  "config": {
                    "script": "\tself.getSibling(\"EmbeddedView\").props.path\u003d\u0027Page/Item_BOM\u0027"
                  },
                  "scope": "G",
                  "type": "script"
                }
              }
            },
            "meta": {
              "name": "bTn_BOM"
            },
            "position": {
              "breakpoints": [
                {
                  "colIndex": 0,
                  "name": "sm",
                  "order": 1,
                  "rowIndex": 3,
                  "span": 3
                },
                {
                  "colIndex": 0,
                  "name": "md",
                  "order": 1,
                  "rowIndex": 3,
                  "span": 3
                },
                {
                  "colIndex": 0,
                  "name": "lg",
                  "order": 1,
                  "rowIndex": 3,
                  "span": 3
                }
              ],
              "height": 60,
              "width": 0.2163,
              "x": 0.0213,
              "y": 0.908
            },
            "propConfig": {
              "props.enabled": {
                "binding": {
                  "config": {
                    "expression": "if(({view.params.ProductionID})!\u003d0,true,false)"
                  },
                  "type": "expr"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Core/Inputs/PrimaryButton"
              },
              "text": "1. Kusovník"
            },
            "type": "ia.input.button"
          },
          {
            "events": {
              "dom": {
                "onClick": {
                  "config": {
                    "script": "\tself.getSibling(\"EmbeddedView\").props.path\u003d\u0027Page/Item_Instructions\u0027"
                  },
                  "scope": "G",
                  "type": "script"
                }
              }
            },
            "meta": {
              "name": "bTn_Instructions"
            },
            "position": {
              "breakpoints": [
                {
                  "colIndex": 3,
                  "name": "sm",
                  "order": 2,
                  "rowIndex": 3,
                  "span": 3
                },
                {
                  "colIndex": 3,
                  "name": "md",
                  "order": 2,
                  "rowIndex": 3,
                  "span": 3
                },
                {
                  "colIndex": 3,
                  "name": "lg",
                  "order": 2,
                  "rowIndex": 3,
                  "span": 3
                }
              ],
              "height": 60,
              "width": 0.2175,
              "x": 0.2563,
              "y": 0.908
            },
            "propConfig": {
              "props.enabled": {
                "binding": {
                  "config": {
                    "expression": "//TODO when Postup is ready then:\r\n//if(({view.params.ProductionID})!\u003d0,true,false)\r\n//but for now:\r\nfalse"
                  },
                  "type": "expr"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Core/Inputs/PrimaryButton"
              },
              "text": "2. Postup"
            },
            "type": "ia.input.button"
          },
          {
            "events": {
              "component": {
                "onActionPerformed": {
                  "config": {
                    "script": "\ta\u003d0\n\tlogger\u003dsystem.util.logger(\u0027Save_ItemRecord\u0027)\n\tlogger.info(\u0027fired\u0027)\n\t\n\t\n\tWorkerId\u003dself.session.custom.workerID\n\tMachineId\u003dstr(self.getSibling(\"EmbeddedView\").props.params.machineID)\n\t#TODO Feedback\n\tSelectedDate\u003dsystem.date.parse(self.session.custom.selectedDate\t, \u0027dd.MM.yyyy\u0027)\t\n\tShiftID\u003dself.session.custom.shiftID\n\tSetterPersonalId\u003dself.getSibling(\"EmbeddedView\").props.params.SetterPersonalId\n\tOperationId\u003dself.getSibling(\"EmbeddedView\").props.params.OperationID\n\tWorkListId\u003dself.getSibling(\"EmbeddedView\").props.params.WorkListId\n\tProductionOrderId\u003dself.view.params.ProductionID\n\tHoursSpend\u003dself.getSibling(\"EmbeddedView\").props.params.HoursSpend\n\tPieces_GoodCount\u003dself.getSibling(\"EmbeddedView\").props.params.Pieces_GoodCount\n\tPieces_ScrapProcessCount\u003dself.getSibling(\"EmbeddedView\").props.params.Pieces_ScrapProcessCount\n\tNote\u003dself.getSibling(\"EmbeddedView\").props.params.Note\n\t\n\tparams_dict\u003d{\u0027WorkerId\u0027:WorkerId,\u0027MachineId\u0027:MachineId,\u0027SelectedDate\u0027:SelectedDate,\u0027ShiftID\u0027:ShiftID,\u0027SetterPersonalId\u0027:SetterPersonalId,\n\t\t\t\t\u0027OperationId\u0027:OperationId,\u0027WorkListId\u0027:WorkListId,\u0027ProductionOrderId\u0027:ProductionOrderId,\u0027HoursSpend\u0027:HoursSpend,\u0027Pieces_GoodCount\u0027:Pieces_GoodCount,\n\t\t\t\t\u0027Pieces_ScrapProcessCount\u0027:Pieces_ScrapProcessCount,\u0027Note\u0027:Note}\n\t\t\t\t\n\tlogger.info(\u0027params_dict: \u0027+str(params_dict))\t\n\t\t\n\tnamedQuery\u003d\u0027SpringInsertion/WorkList_SingleRecordSave\u0027\n\treturnedDataset\u003dsystem.db.runNamedQuery(namedQuery,params_dict)\n\t\n\t\n\tsystem.perspective.navigate(view \u003d \u0027Page/Dashboard\u0027, params \u003d {\u0027workspaceURL\u0027:MachineId})"
                  },
                  "scope": "G",
                  "type": "script"
                }
              }
            },
            "meta": {
              "name": "bTn_Save"
            },
            "position": {
              "breakpoints": [
                {
                  "colIndex": 9,
                  "name": "sm",
                  "order": 4,
                  "rowIndex": 3,
                  "span": 3
                },
                {
                  "colIndex": 9,
                  "name": "md",
                  "order": 4,
                  "rowIndex": 3,
                  "span": 3
                },
                {
                  "colIndex": 9,
                  "name": "lg",
                  "order": 4,
                  "rowIndex": 3,
                  "span": 3
                }
              ],
              "height": 60,
              "width": 0.2513,
              "x": 0.7275,
              "y": 0.908
            },
            "propConfig": {
              "props.enabled": {
                "binding": {
                  "config": {
                    "expression": "if({../EmbeddedView.props.path}\u003d\u0027Page/Item_Record\u0027\u0026\u0026{../EmbeddedView.props.params.dataValid}\u003d1,true,false)"
                  },
                  "type": "expr"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Core/Inputs/SuccessButton"
              },
              "text": "4. Uložit a zavřít"
            },
            "type": "ia.input.button"
          },
          {
            "meta": {
              "name": "descriptionFlexLabel_Zapis"
            },
            "position": {
              "breakpoints": [
                {
                  "colIndex": 0,
                  "name": "sm",
                  "order": 1,
                  "rowIndex": 0,
                  "span": 9
                },
                {
                  "colIndex": 0,
                  "name": "md",
                  "order": 0.5,
                  "rowIndex": 0,
                  "span": 4
                },
                {
                  "colIndex": 0,
                  "name": "lg",
                  "order": 1,
                  "rowIndex": 0,
                  "span": 4
                }
              ],
              "height": "",
              "width": 0.3825,
              "x": 0.005,
              "y": 0.008
            },
            "props": {
              "params": {
                "text": " Zápis úkoláku : "
              },
              "path": "Core/DescriptionFlexLabel",
              "style": {
                "fontSize": 20
              }
            },
            "type": "ia.display.view"
          },
          {
            "meta": {
              "name": "productionOrderIdFlexInput"
            },
            "position": {
              "breakpoints": [
                {
                  "colIndex": 0,
                  "name": "sm",
                  "order": 0.5,
                  "rowIndex": 1,
                  "span": 6
                },
                {
                  "colIndex": 0,
                  "name": "md",
                  "order": 0.5,
                  "rowIndex": 1,
                  "span": 6
                },
                {
                  "colIndex": 0,
                  "name": "lg",
                  "order": 0.5,
                  "rowIndex": 1,
                  "span": 6
                }
              ],
              "rotate": {
                "anchor": "44% 50%"
              },
              "width": 1,
              "x": 0.0069,
              "y": 0.0893
            },
            "propConfig": {
              "meta.visible": {
                "binding": {
                  "config": {
                    "expression": "if(({view.params.ProductionID})!\u003d0,false,true)"
                  },
                  "type": "expr"
                }
              },
              "props.params.value": {
                "onChange": {
                  "enabled": null,
                  "script": "\tif self.props.params.isValid\u003d\u003dTrue or self.props.params.isValid\u003d\u003d\u0027True\u0027 or self.props.params.isValid\u003d\u003d\u0027true\u0027:\n\t\t#self.parent.custom.Production_ID\u003dself.props.params.value\n\t\tself.view.params.ProductionID\u003dself.props.params.value\n\t\tself.getSibling(\"EmbeddedView\").meta.visible\u003dTrue\n\t\t\n\t\t"
                }
              }
            },
            "props": {
              "params": {
                "isRequired": true,
                "isValid": false,
                "labelText": " Zakázka",
                "labelVisible": true,
                "loading": false,
                "onChange": true,
                "setFocus": true,
                "setFocusWhenInvalid": true,
                "validate": true,
                "validateOrderIsReceived": false,
                "value": ""
              },
              "path": "Core/ProductionOrderIdFlexInput"
            },
            "type": "ia.display.view"
          },
          {
            "events": {
              "dom": {
                "onClick": {
                  "config": {
                    "params": {},
                    "view": "Page/Dashboard"
                  },
                  "scope": "C",
                  "type": "nav"
                }
              }
            },
            "meta": {
              "name": "btnCancel"
            },
            "position": {
              "breakpoints": [
                {
                  "colIndex": 9,
                  "name": "sm",
                  "order": 1.5,
                  "rowIndex": 0,
                  "span": 3
                },
                {
                  "colIndex": 9,
                  "name": "md",
                  "order": 1.5,
                  "rowIndex": 0,
                  "span": 3
                },
                {
                  "colIndex": 9,
                  "name": "lg",
                  "order": 1.5,
                  "rowIndex": 0,
                  "span": 3
                }
              ],
              "height": 60,
              "width": 0.1725,
              "x": 0.8109,
              "y": 0.016
            },
            "props": {
              "image": {
                "height": 38,
                "icon": {
                  "color": "#FFFFFF",
                  "path": "material/close"
                },
                "width": 38
              },
              "style": {
                "classes": "Core/Inputs/DangerButton"
              },
              "text": "Zrušit"
            },
            "type": "ia.input.button"
          },
          {
            "events": {
              "dom": {
                "onClick": {
                  "config": {
                    "script": "\tself.getSibling(\"EmbeddedView\").props.path\u003d\u0027Page/Item_Record\u0027"
                  },
                  "scope": "G",
                  "type": "script"
                }
              }
            },
            "meta": {
              "name": "bTn_ItemRecord"
            },
            "position": {
              "breakpoints": [
                {
                  "colIndex": 6,
                  "name": "sm",
                  "order": 3,
                  "rowIndex": 3,
                  "span": 3
                },
                {
                  "colIndex": 6,
                  "name": "md",
                  "order": 3,
                  "rowIndex": 3,
                  "span": 3
                },
                {
                  "colIndex": 6,
                  "name": "lg",
                  "order": 3,
                  "rowIndex": 3,
                  "span": 3
                }
              ],
              "height": 60,
              "width": 0.2163,
              "x": 0.4925,
              "y": 0.908
            },
            "propConfig": {
              "props.enabled": {
                "binding": {
                  "config": {
                    "expression": "if(({view.params.ProductionID})!\u003d0,true,false)"
                  },
                  "type": "expr"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Core/Inputs/PrimaryButton"
              },
              "text": "3. Záznam"
            },
            "type": "ia.input.button"
          },
          {
            "meta": {
              "name": "EmbeddedView",
              "visible": false
            },
            "position": {
              "breakpoints": [
                {
                  "colIndex": 0,
                  "name": "sm",
                  "order": 1,
                  "rowIndex": 2,
                  "span": 12
                },
                {
                  "colIndex": 8,
                  "name": "md",
                  "order": 1,
                  "rowIndex": 2,
                  "span": 12
                },
                {
                  "colIndex": 0,
                  "name": "lg",
                  "order": 1,
                  "rowIndex": 2,
                  "span": 12
                }
              ],
              "height": 700,
              "width": 0.9888,
              "x": 0.0061,
              "y": 0.2008
            },
            "propConfig": {
              "props.params.Article_ID": {
                "binding": {
                  "config": {
                    "path": "view.custom.ArticleID"
                  },
                  "type": "property"
                }
              },
              "props.params.Production_ID": {
                "binding": {
                  "config": {
                    "path": "view.params.ProductionID"
                  },
                  "type": "property"
                }
              },
              "props.params.WorkListId": {
                "binding": {
                  "config": {
                    "path": "view.params.WorkListId"
                  },
                  "type": "property"
                }
              },
              "props.params.machineID": {
                "binding": {
                  "config": {
                    "path": "view.params.machineID"
                  },
                  "type": "property"
                }
              }
            },
            "props": {
              "params": {
                "HoursSpend": 0,
                "Note": "",
                "OperationID": 899,
                "Pieces_GoodCount": 0,
                "Pieces_ScrapProcessCount": 0,
                "SetterPersonalId": 0,
                "dataValid": 1
              },
              "path": "Page/Item_BOM"
            },
            "type": "ia.display.view"
          },
          {
            "events": {
              "dom": {
                "onClick": {
                  "config": {
                    "draggable": false,
                    "id": "h4YCDpcG",
                    "modal": true,
                    "overlayDismiss": false,
                    "resizable": false,
                    "showCloseIcon": false,
                    "type": "open",
                    "viewParams": {
                      "callerMessageHandler": "fillProductionOrderId",
                      "callerValue": "",
                      "decimalPlaces": "0",
                      "isDecimal": "false",
                      "maxLength": "9",
                      "maxValue": "999999999"
                    },
                    "viewPath": "Core/NumericKeyboardCoord"
                  },
                  "scope": "C",
                  "type": "popup"
                }
              }
            },
            "meta": {
              "name": "writeProductionOrderId"
            },
            "position": {
              "breakpoints": [
                {
                  "colIndex": 7,
                  "name": "sm",
                  "order": 1.5,
                  "rowIndex": 1,
                  "span": 1
                },
                {
                  "colIndex": 6,
                  "name": "md",
                  "order": 1,
                  "rowIndex": 1,
                  "span": 1
                },
                {
                  "colIndex": 7,
                  "name": "lg",
                  "order": 1.5,
                  "rowIndex": 1,
                  "span": 1
                }
              ],
              "height": 45
            },
            "props": {
              "image": {
                "position": "center"
              },
              "style": {
                "backgroundImage": "/system/images/numeric-keypad.png"
              },
              "text": ""
            },
            "type": "ia.input.button"
          }
        ],
        "meta": {
          "name": "ColumnContainer"
        },
        "position": {
          "height": 1,
          "width": 1
        },
        "type": "ia.container.column"
      }
    ],
    "custom": {
      "Production_ID": 0,
      "delProduction_ID": 0
    },
    "meta": {
      "name": "root"
    },
    "props": {
      "mode": "percent"
    },
    "scripts": {
      "customMethods": [
        {
          "name": "Init",
          "params": [],
          "script": "\tlogger\u003dsystem.util.logger(\u0027Item_Main_Root_Init\u0027)\n\tlogger.info(\u0027fired\u0027)\n\tlogger.info(\u0027WorkListId: \u0027+str(self.view.params.WorkListId))\n\tWorkListId\u003dself.view.params.WorkListId\n\n\tif WorkListId\u003e0:\t\t\n\t\t#self.custom.Production_ID\u003dself.view.params.ProductionID\t\t\n\t\tself.getChild(\"ColumnContainer\").getChild(\"EmbeddedView\").meta.visible\u003dTrue\n\t\t\t\n\telif self.view.params.WorkListId\u003d\u003d0:\n\t\tself.getChild(\"ColumnContainer\").getChild(\"EmbeddedView\").meta.visible\u003dFalse\n\t\n\tself.getChild(\"ColumnContainer\").getChild(\"EmbeddedView\").props.path\u003dself.view.params.initEmbededView"
        }
      ],
      "messageHandlers": [
        {
          "messageType": "fillProductionOrderId",
          "pageScope": true,
          "script": "\t# implement your handler here\n\tlogger\u003dsystem.util.logger(\u0027productionOrderIdFill\u0027)\n\tlogger.info(payload)\n\tself.view.params.ProductionID\u003dself.props.params.value",
          "sessionScope": true,
          "viewScope": true
        }
      ]
    },
    "type": "ia.container.coord"
  }
}

yes viewparam is bidirrectional

I see no onchange scripts or bidirrectional bindings to any of the embedded views xd

could you also provide the embedded view itself?

These are the params of embedded input text type
image

This is a message handler which receives value and sets value param

This is a change script which is set on Value
T

I tried also changing param isValid to true programatically but nothing happened.

EDIT:
Okay this is really weird, now I set isValid param to True again and suddenly its working
self.getChild("ColumnContainer").getChild("productionOrderIdFlexInput").props.params.isValid = True

Im really not following the code, but it works now? xd

yes, it is :slight_smile:

1 Like