0

ツリー フィールド (プラグイン列) がある道場 dgrid を実行しました。ユーザーがダウンロードできるように、各サブ行にアイコン(PDF、HTML、およびXLS)を配置しようとしています。アイコンを作成するために formatter: function(item, rowIndex, cell)を使用しようとしましたが、ツリー列が破損し、単に作業が停止します。ドキュメントでやりたいことのようなものは見つかりませんでした。

次の画像は私の例を示しています。 アイコンの下位行

私もHTMLを混ぜてみましたが、うまくいきませんでした。HTMLとJavaScriptを混ぜて、このようにしたくありません。

これどうやってするの?

4

1 に答える 1

2

それが最善の解決策かどうかはわかりませんが、私はこの方法で解決しました。

新しい列 (プラグイン列) を作成し、CSS 全体で列間の垂直線を取り出しました (colspan をシミュレートするため)。ただし、dgrid を使用して colspan を実行することもできますが、私は CSS (より簡単) を使用することを好みました。

私のプラグイン列は次のようになりました:

editor({label: ' ', field: 'idDOC', sortable: false, canEdit: function(obj){

                    if(obj.type == 'DOC'){

                        if(obj.format == 'xls'){
                            this.editorArgs.iconClass = 'dijitEditorIcon dijitEditorIconXls';
                        }

                        if(obj.format == 'html'){
                            this.editorArgs.iconClass = 'dijitEditorIcon dijitEditorIconHtml';
                        }

                        if(obj.format == 'pdf'){
                            this.editorArgs.iconClass = 'dijitEditorIcon dijitEditorIconPdf';
                        }

                        return true;
                    }

                    return false;

                }, editorArgs:{onClick: function(obj){

                    var node = that.memoryStore.get(that.designId);
                    var format;

                    for(var i=0; i<node.children.length; i++){

                        if(node.children[i].id == this._dgridLastValue){
                            format = node.children[i].format;
                        }

                    }

                    window.location.href = that.domain+'/'+that.designId+'/'+this._dgridLastValue+'/'+format;

                }, label:'View', showLabel:true}}, Button),

ありがとう

于 2012-11-30T11:33:44.457 に答える