Building Applications with Force.com and VisualForce (DEV401) (二四):JavaScript in Visualforce
Dev401-025:Visualforce Pages: JavaScript in Visualforce
Module Objectives
1.Describe the use of AJAX within Visualforce.
2.Create access to standard actions via the $URLFOR expression.
3.Create reusable functions within ,script> tags.
4.Create partial page refreshes on javaScript events.
5.Describe the usage of the AJAX action components.
Module Agenda
1.Action Biding and javaScript
2.JavaScript Functions
3.Partial page Updates
4.Asymchronous Operation Status
5.AJAX Behavior on Events
Using JavaScript to Reference Components
1.Every Visualforce tag has an id attribute. The id attribute for a tag can be used by another tag to bind the two tags together. For example, the <apex:outputLabel> tag’s for attribute can be used with the <apex:inputField> tag’s id attribute. The reRender and status attributes on <apex:actionFunction>, <apex:actionSupport>, and other action-oriented components also use the value of the id attribute from other components.
2.In addition to being used to bind Visualforce components together, this ID is used to form part of the document object model (DOM) ID for the component when the page is rendered.
3.To refer to a Visualforce component in JavaScript or another Web-enabled language, you must specify a value for the id attribute for that component. A DOM ID is constructed from a combination of the id attribute of the component and the id attributes of all components that contain the element.
Using a JavaScript Library with Visualforce
1.You can include JavaScript libraries in your Visualforce pages to take advantage of functionality provided by these libraries.
2. The best way to include JavaScript libraries is by creating a static resource, and then including the library by adding an <apex:includeScript> component to your page.
3.For example, if you are using MooTools (http://mootools.net/), create a static resource from the library called mootools, and then reference it in a page like this:
<apex:page>
<apex:includeScript value="{!$Resource.mootools}"/>
</apex:page>
Apex:actionStatus
1.A component that displays the status of an AJAX update request. An AJAX request can either be in progress or complete.
2.Example
<!-- Page: -->
<apex:page controller="exampleCon">
<apex:form>
<apex:outputText value="Watch this counter: {!count}" id="counter"/>
<apex:actionStatus startText=" (incrementing...)"
stopText=" (done)" id="counterStatus"/>
<apex:actionPoller action="{!incrementCounter}" rerender="counter"
status="counterStatus" interval="15"/>
</apex:form>
</apex:page>
/*** Controller: ***/
public class exampleCon {
Integer count = 0;
public PageReference incrementCounter() {
count++;
return null;
}
public Integer getCount() {
return count;
}
}
Visualforce Components & javaScript Events
1.Many Visualforce tags relate to different UI components.
2.These often have attributes equivalent to JavaScript events to handle user actions to those components.
Partial page Refreshes for Conditional Fields
1.Goal(s)
- Override the position new page to only display certain fields based on the values of others, and refresh only the part of the page taht is required.
2.Scenarion:
- Universal Containers wants to provide a similar functionality to record types in providing different fields on the page depending on the values of the others. However,with Visualforce they have heard that they can not only make this dynamic, but also so thatit only requires a partial page refresh.
- The postion page should only display the Technical Skills section when the Department is set to IT or Engineering.
3.Tasks:
- Add the pre-existing visualforce page to your org.
- Override te Position New button.
- Test the page.
Module Review
1.What are soem examples of JavaScript Events?
2.What is AJAX typically used for in Visualforce?How this different from s-controls?
partial page refresh
3.Why would you need to use the global $URLFOR variable?
4.What is the purpose of script tags?
5.What are the different AJAX action tags? What does each do?
6.How can you create partial page refreshes? How does the method change depending on the context?
Building Applications with Force.com and VisualForce (DEV401) (二四):JavaScript in Visualforce的更多相关文章
- Building Applications with Force.com and VisualForce(Dev401)(十八):Visualforce Pages: Introduction to Visualforce
Dev401-020:Visualforce Pages: Introduction to Visualforce Course Objectives1.Understand the benefits ...
- Building Applications with Force.com and VisualForce(Dev401)(十):Designing Applications for Multiple Users: Building Business Processes that You Want
Dev401-011: Building Business Processes that You Want Course Objectives1.Describe the capabilities o ...
- Building Applications with Force.com and VisualForce (DEV401) (四):Building Your user Interface
Dev 401-004:Application essential:Building Your user Interface: Module Agenda1.Custom Applications2. ...
- Building Applications with Force.com and VisualForce (DEV401) (三):Application Essential:Building Your Data Model
Dev 401-003:Application Essential:Building Your Data Model Object Relationships1.Link two objects- P ...
- Building Applications with Force.com and VisualForce (DEV401) (二) : Application Essentials:Designing Application on the Force.com Platform
Dev 401-002:Application Essentials:Designing Application on the Force.com Platform Course Objectives ...
- Building Applications with Force.com and VisualForce(Dev401)(七):Designing Applications for Multiple users:Managing your users' experience I
Dev 401-007 Designing Applications for Multiple users: Managing your users' experience part 1 Module ...
- Building Applications with Force.com and VisualForce (DEV401) (二五):Visualforce Controller
Dev401-026:Visualforce Pages: Visualforce Controller Module Objectives1.Identify the functionality ...
- Building Applications with Force.com and VisualForce (DEV401) (二一):Visualforce Componets (Tags) Library Part 1
Dev401-022:Visualforce Pages: Visualforce Componets (Tags) Library Part 1 Module Objectives1.List ke ...
- Building Applications with Force.com and VisualForce (DEV401) (二三):Visualforce Componets (Tags) Library Part III
Dev401-024:Visualforce Pages: Visualforce Componets (Tags) Library Part IIIStatic Resources1.Static ...
随机推荐
- 初识SpringAOP
概述 AOP(Aspect Oriented Programming),即面向切面编程 通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术.AOP是OOP的延伸,是软件系统开发中的一个 ...
- 教你如何去除电脑QQ聊天窗口上的广告?
当打开QQ聊天窗口时,就如下图一样各种广告不停地闪啊闪的,我没强迫症但是我也不喜欢看. 像咱们这些没有钱开会员又不喜欢整天看电脑QQ聊天窗口上的广告的"穷人们".那该咋办呢?好了, ...
- Python——6切片
*/ * Copyright (c) 2016,烟台大学计算机与控制工程学院 * All rights reserved. * 文件名:text.cpp * 作者:常轩 * 微信公众号:Worldhe ...
- 关于Markdown下无法使用表格的解决方案
关于Markdown下无法使用表格的解决方案 写表格,出现如下场景 解决方法.点击左下角M的表示,切换到extra模式 打开了新世界.如果不能点击,估计是你没有激活pro的权限,百度下就可以了. 或者 ...
- Zabbix自动发现并监控磁盘IO、报警
本文转载自: https://www.93bok.com 引言 Zabbix并没有提供模板来监控磁盘的IO性能,所以我们需要自己来创建一个,由于一台服务器中磁盘众多,如果只有一两台可以手动添加,但服务 ...
- node--静态文件托管,路由,模板引擎
1.路由 路由是由一个URI和一个特定的HTTP方法(GET/POST)组成的 涉及到应用如何响应客户端对某个网站节点的访问 2.ejs 3.get/post 1)get获取数据 通过Url类中的qu ...
- Deepin环境下启动Pycharm没有启动图标解决办法
小伙伴们在deepin下运行pycharm时,是不是需要通过sh文件启动? 下面告诉大家如何将pycharm图标放在桌面上: 1.在桌面打开终端,输入命令: sudo gedit /usr/share ...
- C# 视频监控系统(提供源码分享)
去过工厂或者仓库的都知道,在工厂或仓库里面,会有很多不同的流水线,大部分的工厂或仓库,都会在不同流水线的不同工位旁边安装一台电脑,一方面便于工位上的师傅把产品的重要信息录入系统,便于公司系统数据采集分 ...
- js的Set和Map集合
目录 1.js的Set介绍 1-1.Set基础用法 1-2.Set对象的操作方法 1-3.Set对象的遍历方法 2.js的Set扩展WeakSet篇 3.js的Map介绍 3-1.Map基础用法 3- ...
- oracle12c数据库第一周小测验
一.单选题(共4题,30.4分) 1 ( )是位于用户与操作系统之间的一层数据管理软件.数据库在建立.使用和维护时由其统一管理.统一控制. A. A.DBMS B. B.DB C. C.DBS ...