TermEdit.putCustom

Syntax

putCustom(text, formula, position);

Parameters

text. Text of the custom term to be placed to the collection.

formula. Custom term formula.

position. Optional parameter that specifies the position in which the custom term will be placed.

Description

The putCustom method adds a custom term to term editor.

Example

To execute the example on HTML page in the HEAD tag, add links to the PP.js component library and PP.css and TermEdit.css visual styles. Create the TermEdit component and add the button, clicking which performs the putTerms() function:

<body>

<!--Term editor-->

<div id = "TE"></div>

<br/>

<!--Button-->

<input type="button" value="put terms" onclick="putTerms();" style="vertical-align: top;" />

<script type ="text/javascript">

//Create a term editor

var termEdit = new PP.Ui.TermEdit(

    {

         ParentNode: "TE",

         Width: 200,

         Height: 100

    });

//Function for adding terms to the editor

function putTerms() {

//Create a term:

    var term1 = new PP.Ui.Term(

    {

         Text: "Term1",

         IsHyperlink: false,

         IsLiteral: false,

         Formula: "FORMULA",

         Selected: false

    });

//Add the term to the collection

    term1.add

//Add the term to the editor

    termEdit.putTerm(term1);

//Add a custom term to the editor

    termEdit.putCustom("+", "plus", 0);

//Add a literal term to the editor

    termEdit.putLiteral("Term2");

   }

</script>

</body>

After executing the example, the HTML page contains the term editor and the button named "put terms", clicking which adds a term with the Term1 text, the + custom term and the Term2 literal term:

See also:

TermEdit