1

私は奇妙な状況につまずいた。

Dojo AMD バージョンを使用します。1.9。dojo.connect は dojo.on に置き換えられます

これまでのところ、すべて問題ありません。ここで、Eventlistener (チェックボックスが選択されている) を EnhancedGrid の IndirectSelection プラグインに接続したいと考えています。dojo.on で解決策を検索しましたが、dojo.connect しか見つかりませんでした?!

あれは正しいですか?dojo.connect は一般的に dojo 1.9 で非推奨になったということですか?

これは私が道場側で見つけたコードです:

dojo.connect(grid.selection, 'onSelected'|'onDeselected', function(rowIndex){...})

参照: http://dojotoolkit.org/reference-guide/1.9/dojox/grid/EnhancedGrid/plugins/IndirectSelection.html#usages

ここに私のコードがあります:

if(!registry.byId("GraphGrid")){
        grid = new EnhancedGrid({
                    id: 'GraphGrid',
                    store: GraphicStore,
                    query: { ident: "*" },
                    structure: layout,
                    rowSelector: '20px',
                    keepSelection: false,
                    plugins: {
                        indirectSelection: {
                        headerSelector:false, 
                        width:"40px", 
                        styles:"text-align: center;"
                        }}                          
                    },"GridGraphicInMap");

                /*Call startup() to render the grid*/
                grid.startup();

                grid.on("rowClick", function(evt){
                    var idx = evt.rowIndex,
                        item = this.getItem(idx);
                    //  get a value out of the item
                    var value = this.store.getValue(item, "geom");
                    highlightGeometry(value,true);
                });

                dojo.connect(grid.selection, 'onSelected', getSelectedItems);

                }
                else {
                    setTimeout(function(){
                    grid.setStore(GraphicStore);
                    }, 1000);
                }...

dojo.on または grid.selection.on('Selected',getSelectedItems); に変更しようとしました。しかし、うまくいきません。この特殊なケースでも、dojo.connect は正しい接続方法ですか?

上記のコードは問題なく動作します。問題はありません。

よろしく、ミリアム

4

1 に答える 1

0

イベントのトリガーに影響を与えない dojo.connect を使用できます。そして、次の方法で接続を使用してみてください。

 dojo.connect(grid, 'onSelected', getSelectedItems);

または dojo.connect(grid, 'onselectionchanged', getSelectedItems);

これらのいずれかが機能しない場合はお知らせください。

于 2014-06-20T12:15:59.063 に答える