How do I pass a UIViewKendoGrid row record to the record for a UIViewModal?


#1

Can I use the record obtained from UIActionGetRecordFromGrid as the record in a modal shown in a followup UIActionShowModal? How would I do that?

"action": {
    "type": "UIActionGetRecordFromGrid",
    "gridId": "ListView",
    "followUpActions": [
        {
            "action": {
                "type": "UIActionShowModal",
                "page": "FollowUpDetailsModal",
                "reuseModal": false,
                "forceLoadModalData": true,
                "configsToPass": [
                    {
                        "args.record"
                    }
                ]
            }
        }
    ]
}

#2

I’ve done it by defining the record on the modal as a local data source, then altering UIActionGetRecordFromGrid to populate that data source with an additional input called “targetDataSource” :

function dispatch(component, args, e) {
  var grid        = component.findComponent(this.get("gridId")),
    target      = this.get('target') || (args && args.target) || this.get('trigger.caller.arguments[1].currentTarget'),
    record      = grid.getTrRecord(target.closest('tr')),
    tunneledComponent = this.get("tunneledComponent");

  tunneledComponent = tunneledComponent && component.findComponent(tunneledComponent);

  if (args) {
    if (tunneledComponent) {
      args.component = tunneledComponent;
    }
    args.preventDefault();
  }

  var  environment = this.get("environment"),
  targetDataSource = this.get("targetDataSource"),
  dataSource = environment.getDataSource(targetDataSource);

  dataSource.set('data',null);
  dataSource.setData(record.getData());

}