Comparing text by using API

Compare two properties or texts in a coherent and convenient to interpret way by using the pega.ui.compare.showDiff API.

 

API

pega.ui.compare.showDiff

Description

Used to display differences between any property or text in an easy to interpret way in a dialog box consisting 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 to. Changes are shown live as you edit the contents of the left pane.

Type

JavaScript API

Class

N/A

Parameters

Required:

event: javascript:event

language: format of the compared strings. Available values: application/x-jsp, css, html, jsp, js, javascript, java, text, text/x-java, text/plain

fetch: If you are passing the original string value in the currentString and compareString, set this parameter value to string. If you want the API to open rule xml 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/inskey of the current rule

compareString: Property value/inskey of the compared rule

propertyName: If the value of the fetch parameter is inskey, provide the name of property to be compared after fetching rule xml using the inskey value provided. Use the format: "currentString/compareString"

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 will be passed to this callback

cancelCallback: Callback function to be called after clicking Cancel in the dialog box. An updated string will be passed to this callback

ruleClass: pxObjClass value of any rule, for example Rule-Obj-Activity

Optional:

You can add additional parameters and use them with doneCallback and cancelCallback parameter.

These extra parameters will be passed back as parameters of callbacks.

Notes

  • Arguments must be passed in the provided order.

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

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

Panel Body

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.