dojox/grid/enhanced/plugins/Printer (version 1.10)

dojox/grid/enhanced/_Plugin

Summary

Provide printGrid function to the grid.

Usage

var foo = new Printer(grid);
dojox/grid/enhanced/plugins/Printer
Parameter Type Description
grid undefined

Examples

Example 1

dojo.require("dojox.grid.enhanced.plugins.Printer");
dijit.byId("grid1").printGrid("my grid",                    //A title for the grid,optional
                            ["cssfile1.css","cssfile2.css"],//An array of css files to decorate the printed gird,optional
                            {table:"border='border'"}       //tagName:"attrbuteList" pairs, optional,
                                                            //control the html tags in the generated html
);

Property Summary

  • __printArgs
  • _connectsList of all connections.
  • _subscribesList of all subscribes.
  • gridGrid that the plugin belongs to
  • namePlugin name
  • optionPlugin properties - leveraged with default and user specified properties. e.g. for dnd plugin, it may look like {"class": dojox.grid.enhanced.plugins.DnD, "dependency": ["nestedSorting"], ...}
  • privatesPrivate properties/methods shouldn't be mixin-ed anytime.

Method Summary

  • _formalizeArgs(args)
  • _loadCSSFiles(cssFiles)
  • _mixinGrid()
  • _print(htmlStr) Do the print job.
  • _wrapHTML(title,cssFiles,body_content) Put title, cssFiles, and body_content together into an HTML string.
  • connect(obj,event,method) Connects specified obj/event to specified method of this object.
  • destroy() Destroy all resources.
  • disconnect(handle) Disconnects handle and removes it from connection list.
  • exportSelectedToHTML(args,onExported) Export selected rows to HTML string, but do NOT print.
  • exportToHTML(args,onExported) Export to HTML string, but do NOT print.
  • init()
  • normalizeRowHeight(doc)
  • printGrid(args) Print all the data in the grid, using title as a title, decorating generated html by cssFiles, using tagName:"attrbuteList" pairs(writerArgs) to control html tags in the generated html string.
  • printSelected(args) Print selected data.
  • subscribe(topic,method) Subscribes to the specified topic and calls the specified method of this object.
  • unsubscribe(handle) Un-subscribes handle and removes it from subscriptions list.

Event Summary

Properties

__printArgs
_connects

List of all connections.

_subscribes

List of all subscribes.

grid

Grid that the plugin belongs to

name

Plugin name

option

Plugin properties - leveraged with default and user specified properties. e.g. for dnd plugin, it may look like {"class": dojox.grid.enhanced.plugins.DnD, "dependency": ["nestedSorting"], ...}

privates

Private properties/methods shouldn't be mixin-ed anytime.

Methods

_formalizeArgs(args)
Parameter Type Description
args undefined
Returns:object
_loadCSSFiles(cssFiles)
Parameter Type Description
cssFiles undefined
Returns:undefined
_mixinGrid()
_print(htmlStr)

Do the print job.

Parameter Type Description
htmlStr String

The html content string to be printed.

Returns:any

undefined

_wrapHTML(title,cssFiles,body_content)

Put title, cssFiles, and body_content together into an HTML string.

Parameter Type Description
title String

A title for the html page.

cssFiles Array

css file pathes.

body_content String

Content to print, not including part and tags

Returns:any | undefined

the wrapped HTML string ready for print

connect(obj,event,method)

Connects specified obj/event to specified method of this object.

Parameter Type Description
obj undefined
event undefined
method undefined
Returns:undefined

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when foo.bar() is called, call the listener in the scope of plugin
plugin.connect(foo, "bar", function(){
    console.debug(this.xxx());//"this" - plugin scope
});
destroy()

Destroy all resources.

disconnect(handle)

Disconnects handle and removes it from connection list.

Parameter Type Description
handle undefined
exportSelectedToHTML(args,onExported)

Export selected rows to HTML string, but do NOT print. Users can use this to implement print preview. For meaning of arguments see function printGrid

Parameter Type Description
args __printArgs
Optional

Arguments for print.

onExported undefined
exportToHTML(args,onExported)

Export to HTML string, but do NOT print. Users can use this to implement print preview. For meaning of the 1st-3rd arguments see function printGrid.

Parameter Type Description
args __printArgs
Optional

Arguments for print.

onExported undefined

call back function

init()
normalizeRowHeight(doc)
Parameter Type Description
doc undefined
printGrid(args)

Print all the data in the grid, using title as a title, decorating generated html by cssFiles, using tagName:"attrbuteList" pairs(writerArgs) to control html tags in the generated html string.

Parameter Type Description
args __printArgs
Optional

Arguments for print.

printSelected(args)

Print selected data. All other features are the same as printGrid. For meaning of arguments see function printGrid

Parameter Type Description
args __printArgs
Optional

Arguments for print.

subscribe(topic,method)

Subscribes to the specified topic and calls the specified method of this object.

Parameter Type Description
topic undefined
method undefined
Returns:undefined

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when /my/topic is published, call the subscriber in the scope of plugin
// with passed parameter - "v"
plugin.subscribe("/my/topic", function(v){
    console.debug(this.xxx(v));//"this" - plugin scope
});
unsubscribe(handle)

Un-subscribes handle and removes it from subscriptions list.

Parameter Type Description
handle undefined

Events

onPostInit()

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when /my/topic is published, call the subscriber in the scope of plugin
// with passed parameter - "v"
plugin.subscribe("/my/topic", function(v){
    console.debug(this.xxx(v));//"this" - plugin scope
});
onPreInit()

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when /my/topic is published, call the subscriber in the scope of plugin
// with passed parameter - "v"
plugin.subscribe("/my/topic", function(v){
    console.debug(this.xxx(v));//"this" - plugin scope
});
onSetStore(store)

Called when store is changed.

Parameter Type Description
store undefined

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when /my/topic is published, call the subscriber in the scope of plugin
// with passed parameter - "v"
plugin.subscribe("/my/topic", function(v){
    console.debug(this.xxx(v));//"this" - plugin scope
});
onStartUp()

Examples

Example 1

var plugin = new dojox.grid.enhanced._Plugin(grid,"myPlugin",{...});
// when /my/topic is published, call the subscriber in the scope of plugin
// with passed parameter - "v"
plugin.subscribe("/my/topic", function(v){
    console.debug(this.xxx(v));//"this" - plugin scope
});
Error in the documentation? Can’t find what you are looking for? Let us know!