This content has been archived.

Table of Contents

showDiff: Text compare API for comparing properties

showDiff

This API is used to display differences between any property or text in an easy to interpret way in a dialog box that consists of two panes. The left pane that contains the current value is editable, and the right pane contains the reference value that the current value is being compared with. Changes are shown live as you edit the contents of the left pane.

The API does not save the text. After you click Done in the dialog box, the updated content from the left pane is passed to the callback function for users to perform any action.

The pega.ui.compare module is available for every harness.

Syntax

pega.ui.compare.showDiff(event, language, fetch, currentString, compareString, propertyName, currentLabel, compareWithLabel, doneCallback, cancelCallback, ruleClass);

Parameters

This API accepts a JavaScript object, which can have the following key-values. Arguments must be passed in the provided order.

  • event: The Javascript event object triggered by the action. Use the value javascript:event in the run script action.
  • language: The format of the compared strings. The available values are: application/x-jsp, css, html, jsp, js, javascript, java, text, text/x-java, text/plain.
  • fetch: If you are directly passing a string value in the currentString and compareString parameters, set this parameter value to 'string'. If you want the API to open the rule and retrieve the property value, set the parameter value to inskey and provide the inskey values of the rules to be compared in currentString and compareString parameters.
  • currentString: Property value or inskey of the current rule.
  • compareString: Property value or inskey of the compared rule.
  • propertyName: If the value of the fetch parameter is inskey, the name of the property to be compared after opening the rules. Otherwise, set as empty.
  • currentLabel: Header label of the left pane in the compare dialog box.
  • compareWithLabel: Header label of the right pane in the compare dialog box.
  • doneCallback: Callback function to be called after clicking Done in the dialog box. An updated string is passed to this callback.
  • cancelCallback: Callback function to be called after clicking Cancel in the dialog box. An updated string is passed to this callback.
  • ruleClass: pxObjClass value of the rule that is being compared for example Rule-Obj-Activity.
Suggest Edit

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.