NetTalk Central

Author Topic: jQuery in NetTalk : jQuery method and loc:options  (Read 7461 times)

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11175
    • View Profile
jQuery in NetTalk : jQuery method and loc:options
« on: April 15, 2010, 01:39:24 AM »
NetTalk 5, PR12 and later applies.

NetTalk makes extensive use of jQuery - this thread is one of a series of threads on information that may be useful in understanding how jQuery and the NetTalk code fit together.

The goal of this article is to explain the use of the jQuery method, and the loc:options variable.

The jQuery Method

When adding a jQuery item to a page, a common script syntax is often used to initialize the object. The script usually looks something like this;

Code: [Select]
<script type="text/javascript">
$(function() {
$("#div_id").some_action(some_options);
});
</script>

rather than repeatedly create this text a simple method has been created to do the heavy lifting.

Code: [Select]
p_web.jQuery(id,action,options,<more>)
This method returns a string so is usually used like this;

Code: [Select]
packet = p_web.jQueuy('some_div_id','some_action',loc:options)
do Sendpacket

The loc:options variable

Whenever the template generates a call to the jQuery method, it also has an embed point right before the call. This embed point allows you to edit the loc:options variable, which is then used in the call to the jQuery method. By examining the options available (ie by reading the jQuery documentation), you can thus override, or add to, the options being generated by the template.

In this way you have access to all the functionality of any jQuery component which is being used, even if there isn't a specific template option to match every option provided by the jQuery component.

Related methods

A number of the methods in the classes call the jQuery method internally.

CreateDateInput:
The p_Options parameter is passed on to the jQuery call internally. Some items (dateFormat, minDate, maxDate) are added to the options, IF they are not included in the p_Options parameter.

CreateButton:
The p_Options parameter is passed on to the jQuery call internally. Some of the options (text, icons, disabled) are deduced based on the values of other parameters.








« Last Edit: April 15, 2010, 01:55:10 AM by Bruce »