怎么给sql查询出来的结果做事件

0 投票
function processCompleted(queryEventArgs) {
                var i, j, feature,
                        result = queryEventArgs.result;
                if (result && result.recordsets) {
                    for (i=0; i<result.recordsets.length; i++) {
                        if (result.recordsets[i].features) {
                            for (j=0; j<result.recordsets[i].features.length; j++) {
                                feature = result.recordsets[i].features[j];
                                feature.style = style;
                                //给feature做单击事件和指向事件
                                
                                vectorLayer.addFeatures(feature);
                            }
                        }
                    }
                }
            }

代码如上, feature = result.recordsets[i].features[j];feature.style = style; //给feature做单击事件和指向事件  这里我已经能够获取到feature 这个对象了,并添加到地图上了,我这里怎么能够给这个对象设置单击事件、指向事件以及离开事件
6月 14, 2017 分类:  333次浏览 | 用户: 甜逗 初出茅庐 (22 分)

1个回答

0 投票

不能只绑定单个要素的事件,使用SelectFeature控件关联图层,绑定事件即可。
参考博客:
iClient for JavaScript VectorLayer详细使用指南

6月 14, 2017 用户: 毛瑞 名扬四海 (1,780 分)
...