Rule Editor is a self-contained library. Other than .NET and DOM, it doesn't depend on any client or server frameworks or libraries. It is compatible with all newer versions of all major browsers.
-
clear() Returns: Web Rule instance
Parameters: None
Removes all elements of the current rule from the Rule Area.
-
deleted(String)
Returns: Web Rule instance
Parameters:
- id, String - ID of the rule that is being deleted. Required.
Calling this method after deleting a rule is necessary in order to remove this rule from the Rules and context menus. See the related demo for details on saving rules in an Ajax implementation.
-
extract() Returns: String
Parameters: None
Returns a JSON string that contains the current rule, whether or not it’s valid. Returns an empty object if the Rule Area is empty. Use this method if you need to get the current rule in order to evaluate it in the browser. See the related demo for details on client-side rule evaluation.
-
isEvaluationType() Returns: Boolean
Parameters: None
Returns True if the loaded rule is of the evaluation type or if the rule author selected the New evaluation type rule item from the Rules menu of the Toolbar. This method does not check what kind of rule elements the rule author has added to the Rule Area so far.
-
getRuleId() Returns: String
Parameters: None
Returns the string ID of the current rule assigned by Web Rule. Web Rule calls .NET's System.Guid.NewGuid().ToString() to get new IDs for rules. Returns null if no rules have been loaded into the Rule Editor yet, or if Web Rule hasn't assigned an ID to the current rule yet, or if the Rule Editor is empty.
-
loadInvalids(String)
Returns: Web Rule instance
Parameters:
- data, String - JSON string received from the server-side GetClientInvalidData() method of the RuleEditor class in ASP.NET or MVC. See the related demo for details on loading invalid rule data into the Rule Editor in an Ajax implementation. This is a required parameter.
Call this function to load data of the invalid rule into the Rule Editor.
-
loadRule(String)
Returns: Web Rule instance
Parameters:
- data, String - JSON string received from the server-side GetClientRuleData() method of the RuleEditor class in ASP.NET or MVC. See the related demo for details on loading rules into the Rule Editor in Ajax implementation. This is a required parameter.
Call this function to load a rule into the Rule Editor.
-
loadSettings(String)
Returns: Web Rule instance
Parameters:
- data, String - JSON string received from the server-side GetClientSettings() method of the RuleEditor class in ASP.NET or MVC. See the related demo for details on loading Web Rule client settings in Ajax implementation. This is a required parameter.
Call this function to load Web Rule client settings. You also need to call this function every time the rule author requests a change in any of the Web Rule settings such as Help String visibility and so on.
-
saved(String)
Returns: Web Rule instance
Parameters:
- id, String - ID of the rule that has been saved or updated. This parameter is required for new rules but optional for updates.
Calling this method after saving a new rule or updating an existing one is necessary in order to refresh the Rules and context menus with the new or updated values. See the related demo for details on saving rules in an Ajax implementation.
-
setClientActions(Function, Function, Function)
Returns: Web Rule instance
Parameters:
- loadRule, Function - callback that handles loading a rule. This callback function takes one parameter (String type). Web Rule calls this function and passes it the ID of the rule when rule author has selected that rule from the Toolbar's Rules menu. This is a required parameter.
- deleteRule, Function - callback that handles deleting a rule. This callback function takes one parameter (String type). Web Rule calls this function and passes it the ID of the rule when the rule author has clicked the Delete button on the Toolbar. This is a required parameter.
- saveRule, Function - callback that handles saving of a rule. This callback function takes one parameter (Object type). Web Rule calls this function and passes it an object that contains the rule data when the rule author has clicked the Save button on the Toolbar. This callback works in tandem with the LoadClientData() method of the RuleEditor class in ASP.NET or MVC. See the related demo for details on saving rules in an Ajax implementation. This parameter is required.
Call this function while initializing your page to tell Web Rule which functions to call when the rule author wants to load, delete or save a rule. Don't call it if Toolbar is disabled.