Announcement

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

    Unexpected behavior of editNewRecord()

    Hello,

    I am experiencing an issue with how editNewRecord() is affecting a DynamicForm. In the attached, we have a ListGrid, a DynamicForm that will be used to add/edit records, and some buttons to invoke the adding, updating, etc.

    When selecting the 'New' button, editNewRecord() is called. After selecting 'Save' or 'Cancel', the record is saved as expected, however the primaryKey field for the form remains editable even after setting form.canEdit = false.

    Is this expected behavior? How can I truly set the entire form to being un-editable after calling editNewRecord()?

    Thanks!
    Attached Files

    #2
    You can't just assign to the canEdit attribute. There's a setter, setCanEdit().

    Comment


      #3
      Thanks for the quick response. That does not solve the issue. If you look at the logic, the cancel button fires the exact same function whether the 'New' button (editNewRecord()) is selected or the Edit button (editRecord()). The issue only exists when hitting the 'New' button. Why would the behavior be any different after calling the same cancel function?

      I have uploaded the updated logic.

      Thanks again!
      Attached Files

      Comment


        #4
        We can't run your code (it's incomplete) so we're not quite sure what you're seeing here. If canEdit was set on the PK field, that would override form.canEdit. If canEdit was not set on the field, you may be looking at the effect of saveOperationType, which is automatically set by editRecord() or editNewRecord().

        It would be a bug if the PK field ends up editable when the overall form is canEdit:false and there are no settings on the field, or calls to setCanEdit() on the FormItem, that would override the form-level setting. But this code doesn't demonstrate such a bug; we'd need a runnable test case to look further.

        Comment


          #5
          There are not any calls to canEdit on the fields or formitems anywhere in the code or datasource definitions. The canEdit property is set to false in the from defaults. We are calling setCanEdit(false) on the Save and Cancel button functions (shown in the code) and and setCanEdit(true) on the New and Edit button functions.

          I will try to put something runnable together for you to test.

          Comment

          Working...
          X