Where is Editability on reference set selector

2
Today, there’s an update to Jan 2020: https://docs.mendix.com/refguide/reference-set-selector.  What I would like to know is, how can i make a reference set selector read only for certain page views? The role needs read/write access on one page, then after submitting it, they shouldn’t be allowed to edit it is what I am trying to do. 
asked
6 answers
2

There is no editability property on the Reference Set Selector.  What I would suggest is that you have a Reference Set Selector, which is Visible when the Reference Set should be editable, and a Datagrid, which is visible when the Reference Set should be read only.  The Datagrid will display your reference set with no ability to edit it.

***EDIT***

Here is the scenario I set up:

Domain Model:

Page I created

Note that the Reference Set Selector is visible when Active is Yes, the Datagrid is visible when Active is No

How it looks in the UI:   https://youtu.be/9e6ofpUxtHc

Is this what you’re trying to accomplish?

***EDIT2***

Here is the Xpath constraint for the nested datagrid

answered
0

You can show on your page an editable version and an non editable version and then based on conditional visibility show the one or the other. Or make two different versions of the page (use snippets for the parts that are the same) where the one is editable and the other is not. Then after a commit always show the non editable version.

Regards,

Ronald

 

answered
0

I tried setting editable on the page that contains the reference set. Everything else can’t be edited but the reference set still can. I can’t use visibility because I want the user to see the read/write and the read only. 

Is this a bug? Is it because of the many to many association of the reference set?  Especially when it is contained in a data grid that is marked non editable, but the reference set still can be. 

I found a workaround though. I made the Add and the Delete button non visible thus making the reference set read only :)

answered
0

Reference Selector has Editable property: 

 

Reference SET Selector does not: 

answered
0

Here I have a data view and inside it a reference set. I have the data view set as non editable. Notice the icon in the right corner.

When I run it locally, I can still add and delete objects in the reference set. 

This works with references fine. Reference set does not. 

answered
0

We had a similar problem with the ref set selector not being readonly in a readonly Data View. As a workaround we put a snippet widget (addon) to the bottom of the data view with the following JS contents:

  var dataview = dijit.getEnclosingWidget(this.domNode.parentNode);
  if (dataview.get("readOnly")) {
    var childWidgets = dataview.getChildren(true);
    if (childWidgets){
      for (var i = 0; i < childWidgets.length; i++) {
        if (childWidgets[i].declaredClass === "mxui.widget.ReferenceSetSelector") {
          // The selector does not set the readOnly property of its Data Grid
          var refsel = childWidgets[i];
          var datagrid = refsel._datagrid;
          datagrid.set("readOnly", true);
          // If I set readOnly without resetting controlbar then applyContext() will fail inside _setReadOnlyAttr()
          datagrid._gridState.controlbar = false;
        }
      }
    }
  }

 

answered