強化されたグリッドがあり、「プリンター」プラグインを有効にしました。また、dijit/button を作成し、印刷メソッドを呼び出す onClick イベントに接続しました。イベントは発火するので問題ありません。問題は、それが機能しないことです。Opera コンソールに次のメッセージが表示されます。
Uncaught exception: TypeError: Cannot convert 'str' to object
Error thrown at line 511, column 21 in <anonymous function: trim>(str) in http://localhost/ci/assets/js/dojo/_base/lang.js:
return str.trim();
called from line 131, column 3 in <anonymous function: _loadCSSFiles>(cssFile) in http://localhost/ci/assets/js/dojox/grid/enhanced/plugins/Printer.js:
cssFile = lang.trim(cssFile);
called from line 282, column 5 in <anonymous function: map>(arr, callback, thisObject, Ctr) in http://localhost/ci/assets/js/dojo/_base/array.js:
out[i] = callback(arr[i], i, arr);
called from line 130, column 2 in <anonymous function: _loadCSSFiles>(cssFiles) in http://localhost/ci/assets/js/dojox/grid/enhanced/plugins/Printer.js:
var dl = array.map(cssFiles, function(cssFile){
called from line 226, column 2 in <anonymous function: _wrapHTML>(title, cssFiles, body_content) in http://localhost/ci/assets/js/dojox/grid/enhanced/plugins/Printer.js:
return this._loadCSSFiles(cssFiles).then(function(cssStrs){
called from line 125, column 3 in <anonymous function: exportSelectedToHTML>(str) in http://localhost/ci/assets/js/dojox/grid/enhanced/plugins/Printer.js:
_this._wrapHTML(args.title, args.cssFiles, args.titleInBody + str).then(onExported);
called from line 128, column 2 in <anonymous function: exportSelected>(type, writerArgs, onExported) in http://localhost/ci/assets/js/dojox/grid/enhanced/plugins/Exporter.js:
return onExported(this._goThroughGridData(this.grid.selection.getSelected(), writer));
called via Function.prototype.apply() from line 375, column 68 in <anonymous function: hitch>() in http://localhost/ci/assets/js/dojo/_base/lang.js:
return method.apply(scope, arguments || []);
called from line 124, column 2 in <anonymous function: exportSelectedToHTML>(args, onExported) in http://localhost/ci/assets/js/dojox/grid/enhanced/plugins/Printer.js:
this.grid.exportSelected("table", args.writerArgs, function(str){
called from line 94, column 2 in <anonymous function: printSelected>(args) in http://localhost/ci/assets/js/dojox/grid/enhanced/plugins/Printer.js:
this.exportSelectedToHTML(args, lang.hitch(this, this._print));
イベントのコードは次のとおりです。
require([
"dijit/registry"
],function(registry) {
var grid = registry.byId('grid');
grid.printSelected({
"title": "test"
});
});
このプラグインを機能させるために、私ができることを誰かが考えていますか?
PS: Google Chrome でも印刷しようとしましたが、どちらも機能していません... .