Clear Up
SharpKit Reference

ComponentLoader Class

This class is used to load content via Ajax into a Ext.Component. In general this class will not be instanced directly, rather a loader configuration will be passed to the constructor of the Ext.Component.

HTML Renderer

By default, the content loaded will be processed as raw html. The response text from the request is taken and added to the component. This can be used in conjunction with the scripts option to execute any inline scripts in the resulting content. Using this renderer has the same effect as passing the Ext.Component.html configuration option.

Data Renderer

This renderer allows content to be added by using JSON data and a Ext.XTemplate. The content received from the response is passed to the Ext.Component.update method. This content is run through the attached Ext.Component.tpl and the data is added to the Component. Using this renderer has the same effect as using the Ext.Component.data configuration in conjunction with a Ext.Component.tpl.

Component Renderer

This renderer can only be used with a Ext.container.Container and subclasses. It allows for Components to be loaded remotely into a Container. The response is expected to be a single/series of Ext.Component configuration objects. When the response is received, the data is decoded and then passed to Ext.container.Container.add. Using this renderer has the same effect as specifying the Ext.container.Container.items configuration on a Container.

Custom Renderer

A custom function can be passed to handle any other special case, see the renderer option.

Example Usage

  
var cmp = Ext.create('Ext.Component', {
            renderTo: Ext.getBody(),
            tpl: '{firstName} - {lastName}',
            loader: {
            url: 'myPage.php',
            renderer: 'data',
            params: {
            userId: 1
            }
            }
            });
            // call the loader manually (or use autoLoad:true instead)
            cmp.getLoader().load();
            

Namespace: Ext

Base Interfaces

© Copyright 2005-2011 SharpKit. All rights reserved.