dojo.connect in dojox.enhancedGrid plugin IndirectSelection [英] dojo.connect in dojox.enhancedGrid plugin IndirectSelection
问题描述
我偶然发现一个奇怪的情况。
I stumbled about a strange circumstance.
我们使用dojo AMD Vers。 1.9。其中dojo.connect被dojo.on所取代
We use dojo AMD Vers. 1.9. in which dojo.connect is replaced by dojo.on
到目前为止,一切都没问题。现在我想连接一个Eventlistener(复选框被选中)到我的EnhancedGrid的IndirectSelection插件。我用dojo.on搜索一个解决方案,但是只能找到dojo.connect?!
So far all is okay. Now i want to connect an Eventlistener ( Checkbox is Selected) to the IndirectSelection-plugin of my EnhancedGrid. I search for a solution with dojo.on but just find dojo.connect?!
是正确的吗?我的意思是dojo.connect在dojo 1.9中被弃用了generaly?
Is that correct? I mean dojo.connect is deprecated generaly in dojo 1.9?
这是我在dojo方面找到的代码:
This is the code i find in the dojo-side:
dojo.connect(grid.selection, 'onSelected'|'onDeselected', function(rowIndex){...})
这里是我的代码:
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 。对( '已选择',getSelectedItems);但它不工作。在这种特殊情况下,dojo.connect是否正确连接方式?
I tried to change it to dojo.on or grid.selection.on('Selected',getSelectedItems); but it doesn't work. Is in this special Case dojo.connect still the right way to connect?
上面的代码工作正常,这没有什么不对。
The code above works fine, theres nothing wrong with it.
Regards,Miriam
Regards, Miriam
推荐答案
您可以使用dojo.connect它不会影响事件触发。
请尝试以下列方式使用您的连接:
You can use dojo.connect it wont affect event triggering. And try using your connect in the following manner:
dojo.connect(grid, 'onSelected', getSelectedItems);
或
dojo.connect(grid,'onselectionchanged',getSelectedItems);
or dojo.connect(grid, 'onselectionchanged', getSelectedItems);
请让我知道,如果这些都不起作用。
Please let me know if any of these doesn't work.
这篇关于dojo.connect in dojox.enhancedGrid plugin IndirectSelection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!