Class TClientScript

Description

TClientScript class

Allows importing of Prado Client Scripts from template via the PradoScripts property. Multiple Prado client-scripts can be specified using comma delimited string of the javascript library to include on the page. For example,

  1.  <com:TClientScript PradoScripts="effects, rico" />

Custom javascript files can be register using the ScriptUrl property.

  1.  <com:TClientScript ScriptUrl=<%~ test.js %> />

Contents within TClientScript will be treated as javascript code and will be rendered in place.

Since Prado 3.2 the property FlushScriptFiles controls whether Prado will flush the script files defined in the page before rendering the TClientScript contents. If you're not using any external functions in your TClientScript block, you should set the FlushScriptFiles property to false, so Prado can postpone the loading of all the referenced script files further down the page generation cycle.

  • author: Wei Zhuo <weizhuo[at]gmail[dot]com>
  • version: $Id: TClientScript.php 3162 2012-06-04 13:19:53Z ctrlaltca $
  • since: 3.0

Located in /Web/UI/WebControls/TClientScript.php (line 47)

TComponent
   |
   --TApplicationComponent
      |
      --TControl
         |
         --TClientScript
Direct descendents
Class Description
TActiveClientScript TActiveClientScript class
Method Summary
string getPradoScripts ()
string getScriptUrl ()
void onPreRender (mixed $param)
void render (THtmlWriter $writer)
void renderCustomScriptFile (THtmLWriter $writer)
void setFlushScriptFiles (bool $value)
void setPradoScripts (string $value)
void setScriptUrl (string $value)
Methods
getFlushScriptFiles (line 89)
  • return: whether to flush script files using TClientScriptManager::flushScriptFiles() before rendering the script block
  • access: public
bool getFlushScriptFiles ()
getPradoScripts (line 53)
  • return: comma delimited list of javascript libraries to included on the page.
  • access: public
string getPradoScripts ()
getScriptUrl (line 73)
  • return: custom javascript file url.
  • access: public
string getScriptUrl ()
onPreRender (line 107)

Calls the client script manager to add each of the requested client script libraries.

  • access: public
void onPreRender (mixed $param)
  • mixed $param: event parameter

Redefinition of:
TControl::onPreRender()
This method is invoked when the control enters 'OnPreRender' stage.
render (line 125)

Renders the body content as javascript block.

Overrides parent implementation, parent renderChildren method is called during registerCustomScript.

  • access: public
void render (THtmlWriter $writer)

Redefinition of:
TControl::render()
Renders the control.
renderCustomScript (line 147)

Registers the body content as javascript.

  • access: protected
void renderCustomScript (THtmlWriter $writer)

Redefined in descendants as:
renderCustomScriptFile (line 137)

Renders the custom script file.

  • access: protected
void renderCustomScriptFile (THtmLWriter $writer)
  • THtmLWriter $writer: the renderer

Redefined in descendants as:
setFlushScriptFiles (line 97)
  • access: public
void setFlushScriptFiles (bool $value)
  • bool $value: whether to flush script files using TClientScriptManager::flushScriptFiles() before rendering the script block
setPradoScripts (line 65)

Include javascript library to the current page. The current supported libraries are: "prado", "effects", "ajax", "validator", "logger", "datepicker", "colorpicker". Library dependencies are automatically resolved.

  • access: public
void setPradoScripts (string $value)
  • string $value: comma delimited list of javascript libraries to include.
setScriptUrl (line 81)
  • access: public
void setScriptUrl (string $value)
  • string $value: custom javascript file url.

Inherited Methods

Inherited From TControl

TControl::__construct()
TControl::addedControl()
TControl::addParsedObject()
TControl::addToPostDataLoader()
TControl::applyStyleSheetSkin()
TControl::autoBindProperty()
TControl::autoDataBindProperties()
TControl::bindProperty()
TControl::broadcastEvent()
TControl::bubbleEvent()
TControl::clearChildState()
TControl::clearControlState()
TControl::clearNamingContainer()
TControl::clearViewState()
TControl::convertUniqueIdToClientId()
TControl::createChildControls()
TControl::createControlCollection()
TControl::dataBind()
TControl::dataBindChildren()
TControl::dataBindProperties()
TControl::ensureChildControls()
TControl::findControl()
TControl::findControlsByID()
TControl::findControlsByType()
TControl::focus()
TControl::getAdapter()
TControl::getAllowChildControls()
TControl::getAttribute()
TControl::getAttributes()
TControl::getChildControlsCreated()
TControl::getClientID()
TControl::getControls()
TControl::getControlStage()
TControl::getControlState()
TControl::getCustomData()
TControl::getEnabled()
TControl::getEnableTheming()
TControl::getEnableViewState()
TControl::getHasAdapter()
TControl::getHasAttributes()
TControl::getHasChildInitialized()
TControl::getHasControls()
TControl::getHasInitialized()
TControl::getHasLoaded()
TControl::getHasLoadedPostData()
TControl::getHasPreRendered()
TControl::getID()
TControl::getIsSkinApplied()
TControl::getNamingContainer()
TControl::getPage()
TControl::getParent()
TControl::getRegisteredObject()
TControl::getSkinID()
TControl::getSourceTemplateControl()
TControl::getTemplateControl()
TControl::getUniqueID()
TControl::getViewState()
TControl::getVisible()
TControl::hasAttribute()
TControl::initRecursive()
TControl::isDescendentOf()
TControl::isObjectRegistered()
TControl::loadRecursive()
TControl::loadState()
TControl::loadStateRecursive()
TControl::onDataBinding()
TControl::onInit()
TControl::onLoad()
TControl::onPreRender()
TControl::onUnload()
TControl::preRenderRecursive()
TControl::raiseBubbleEvent()
TControl::registerObject()
TControl::removeAttribute()
TControl::removedControl()
TControl::render()
TControl::renderChildren()
TControl::renderControl()
TControl::saveState()
TControl::saveStateRecursive()
TControl::setAdapter()
TControl::setAttribute()
TControl::setChildControlsCreated()
TControl::setControlStage()
TControl::setControlState()
TControl::setCustomData()
TControl::setEnabled()
TControl::setEnableTheming()
TControl::setEnableViewState()
TControl::setID()
TControl::setPage()
TControl::setSkinID()
TControl::setTemplateControl()
TControl::setViewState()
TControl::setVisible()
TControl::trackViewState()
TControl::traverseChildControls()
TControl::unbindProperty()
TControl::unloadRecursive()
TControl::unregisterObject()
TControl::__get()

Inherited From TApplicationComponent

TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()

Inherited From TComponent

TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()
Class Constants

Documentation generated on Mon, 25 Jun 2012 14:37:33 +0200 by phpDocumentor 1.4.3