Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleFunction in Protokoll.js file
// call method for Stamm_ID for foreignkeys new record in panel
akioma.osiv.setForeignKeyCalcMethodStamm_ID = function(self){
    var aForeignKeys = [{
        name: 'Stamm_ID',
        value: "" + self.container.getLink("PRIMARYSDO:TARGET").getValue("stamm_id")
    }];
  return aForeignKeys;
};

 

...

Refreshing the Grid

In order that the ProtokollQuery Grid is updated when a new record is created do the following.

In the main window,, in this case sStammDetailWindow, find the Protokoll DSO and Add an EventAfterSave: $ akioma.osiv.RefreshProtokollQuery(self)

Code Block
languagejs
titleThe event Method in protokoll.js.
//Refresh ProtokollQuery Browse z.b. nach Create, Update, Kopieren, L??schen
akioma.osiv.RefreshProtokollQuery = function(self){
  akioma.eventEmitter.emit(["dataChanged", 'eProtokollQuery']);
};

Save

Code Block
languagejs
titleProtokollSave method from the Menu Function
/**
 * Used in menu function to save the Protokoll record from the Stamm Ribbon menu
 */
akioma.osiv.ProtokollSave = function(self){
  var oBE = self.container.getObject('dProtokollDSO');
  // update   
  oBE.controller.updateRecord({});
};

Copy

Code Block
languagejs
titleSelect the following code from the Menu Function
/**
 * Used in menu function to copy the Protokoll record from the Stamm Ribbon menu
 */
akioma.osiv.ProtokollKopieren = function(ribbon){
  console.log("ProtokollKopieren");
 
  var oBE = ribbon.container.getObject('dProtokollDSO');
  // Copy
  //Set the initial values
  akioma.osiv.setForeignKeyCalcMethodStamm_ID(ribbon);
 
  //launch a container
  var cSelectedHdl  = oBE.getValue('selfhdl');
  var cRepoName      = 'sProtokollCreateDialogWindow';
 
  var promise = app.controller.launchContainer( {
    proc:     "launchContainer.r",
    para:     "RunFile=" + cRepoName + "&Page=*",
    data:     true,
    async:    true
  } );
 
 
  promise.done(function(oRes){
      var BE = oRes.dynObject.getLink("PRIMARYSDO:TARGET").controller;
      BE.stop = true;
 
    // wait for catalog load and then getInitialValues copyRecord
    BE.addAfterCatalogAdd(function(){
      BE.copyRecord(cSelectedHdl);
    });
  });
};

Delete

Code Block
languagejs
/**
 * Used in menu function to save the Protokoll record from the Stamm Ribbon menu
 */
 
akioma.osiv.ProtokollDelete = function(Ribbon){
  console.log ("ProtokollDelete");
  // Find Protokoll
  const oBE = Ribbon.container.getObject('dProtokollDSO');
  var InPapierkorb = oBE.getValue('geloescht');
 
  if (InPapierkorb != true) {
    akioma.message("L??schen nicht m??glich weil Protokoll ist nicht im Papierkorb!");
    return;
  };
 
  // Delete record
  // oBE.controller.deleteRecord({});
  akioma.osiv.deleteRecord (oBE);
};