Provide functions to export the grid data into a given format.
Acceptable plugin parameters:
| Parameter | Type | Description |
|---|---|---|
| grid | dojox/grid/EnhancedGrid | The grid to plug in to. |
| args | undefined |
function onExported(exported_text){
//custom code here...
}
dijit.byId("my_grid_id").exportTo("csv", //registered export format, mandatory
{ //the whole object is optional.
fetchArgs: {start:0,count:1000}, //keywordArgs for fetch, optional
writerArgs: {separator:';'}, //export writer specific arguments, optional
},
function(str){
//call back function, mandatory
});
var result = dijit.byId("my_grid_id").exportSelectedTo("table", //registered export format, mandatory
{separator:'|'} //export writer specific arguments, optional
);
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"], ...}
Private properties/methods shouldn't be mixin-ed anytime.
Use the given export writer(writer) to go through a single row which is given in the context object(arg_obj).
| Parameter | Type | Description |
|---|---|---|
| arg_obj | object | |
| writer | ExportWriter |
undefined
Use the given export format type(fileType) and writer arguments(writerArgs) to create a ExportWriter and return it.
| Parameter | Type | Description |
|---|---|---|
| fileType | string | |
| writerArgs | object |
Optional
|
Use the given export writer(writer) to go through the grid structure and the given rows(items), then return the writer output.
| Parameter | Type | Description |
|---|---|---|
| items | Array | |
| writer | ExportWriter |
Row selectors and row indexes should be recognized and handled separately.
| Parameter | Type | Description |
|---|---|---|
| header_cell | dojox.grid.__CellDef |
Connects specified obj/event to specified method of this object.
| Parameter | Type | Description |
|---|---|---|
| obj | undefined | |
| event | undefined | |
| method | undefined |
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
});
Disconnects handle and removes it from connection list.
| Parameter | Type | Description |
|---|---|---|
| handle | undefined |
Export required rows(fetchArgs) to a kind of format(type) using the corresponding writer with given arguments(writerArgs), then pass the exported text to a given function(onExported).
| Parameter | Type | Description |
|---|---|---|
| type | String | A registered export format name |
| args | Object |
Optional includes: {
fetchArgs: object?
Any arguments for store.fetch
writerArgs: object?
Arguments for the given format writer
}
|
| onExported | undefined | Call back function when export result is ready |
Only export selected rows.
| Parameter | Type | Description |
|---|---|---|
| type | string | A registered export format name |
| writerArgs | object |
Optional Arguments for the given format writer |
| onExported | undefined |
The exported string
Register a writer(writerClsName) to a export format type(fileType). This function separates the Exporter from all kinds of writers.
| Parameter | Type | Description |
|---|---|---|
| fileType | string | |
| writerClsName | string |
| Parameter | Type | Description |
|---|---|---|
| formatter | undefined |
Subscribes to the specified topic and calls the specified method of this object.
| Parameter | Type | Description |
|---|---|---|
| topic | undefined | |
| method | undefined |
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
});
Un-subscribes handle and removes it from subscriptions list.
| Parameter | Type | Description |
|---|---|---|
| handle | undefined |
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
});
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
});
Called when store is changed.
| Parameter | Type | Description |
|---|---|---|
| store | undefined |
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
});
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
});