Announcement

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

    readOnlyWhen criteria not apply at initial edit

    Hi,

    I notice an issue with the code below and I tested it on https://www.smartclient.com/smartcli...=customEditors.
    The read only criteria not apply at initial edit.

    Is this a bug?

    Code:
    isc.ListGrid.create({
      ID: "countryList",
      width: 620,
      height: 224,
      alternateRecordStyles: true,
      cellHeight: 42,
      wrapCells: true,
      dataSource: countryDS,
      fields: [
        { name: "countryName", width: 100 },
        {
          name: "government",
          width: 175,
          editorType: "TextAreaItem",
          editorProperties: { height: 40 },
        },
        { name: "population", width: 100, editorType: "SpinnerItem" },
        {
          name: "independence",
          width: 225,
          editorProperties: {
            readOnlyDisplay: "static",
            readOnlyWhen: {
              _constructor: 'AdvancedCriteria',
              operator: 'and',
              criteria: [
                {
                  fieldName: 'population',
                  operator: 'greaterThan',
                  value: 1000000
                }
              ]
            },
          },
        },
      ],
      autoFetchData: true,
      canEdit: true,
      editEvent: "click",
    });

    #2
    The problem here is there is already a mechanism for determining cell editability - canEditCell, which your code can override to provide editability rules.

    There's no clear way for this to interact with a readOnlyWhen attribute on a FormItem.

    We do plan to introduce a field.readOnlyWhen attribute in a future release and make that determination part of canEditCell.

    For now, we would recommend just using the canEditCell mechanism.

    Comment


      #3
      Alright. Thanks.

      Comment

      Working...
      X