|
36 | 36 | constraints: {
|
37 | 37 | allowedTypes: ['Integer', 'Float', 'Double', 'Decimal']
|
38 | 38 | }
|
| 39 | + }, { |
| 40 | + propertyName: 'Tooltip', |
| 41 | + dataItemType: 'Dimension', |
| 42 | + array: false, |
| 43 | + enableInteractivity: true, |
| 44 | + displayName: 'Tooltip', |
| 45 | + emptyPlaceholder: 'Set Tooltip', |
| 46 | + selectedPlaceholder: 'Configure Tooltip', |
| 47 | + constraints: { |
| 48 | + allowedTypes: ['Text'] |
| 49 | + } |
39 | 50 | }],
|
40 | 51 | customProperties: [{
|
41 | 52 | ownerType: Model.CustomItem,
|
|
101 | 112 | OnlineMapItemViewer.prototype = Object.create(Dashboard.CustomItemViewer.prototype);
|
102 | 113 | OnlineMapItemViewer.prototype.constructor = OnlineMapItemViewer;
|
103 | 114 |
|
104 |
| - OnlineMapItemViewer.prototype._onClick = function (row) { |
| 115 | + OnlineMapItemViewer.prototype._onClick = function (index, row) { |
| 116 | + var markers = this.mapViewer.option('markers'); |
| 117 | + for (var i = 0; i < markers.length; i++) { |
| 118 | + markers[i].tooltip.isShown = i == index; |
| 119 | + } |
| 120 | + |
105 | 121 | this.setMasterFilter(row);
|
106 | 122 | this._updateSelection();
|
107 | 123 | };
|
|
138 | 154 | showMarkers = mode === 'Markers' || mode === 'MarkersAndRoutes' || this.canMasterFilter(),
|
139 | 155 | showRoutes = mode === 'Routes' || mode === 'MarkersAndRoutes';
|
140 | 156 | if (this.getBindingValue('Latitude').length > 0 && this.getBindingValue('Longitude').length > 0) {
|
| 157 | + let index = 0; |
141 | 158 | this.iterateData(row => {
|
142 | 159 | var latitude = row.getValue('Latitude')[0];
|
143 | 160 | var longitude = row.getValue('Longitude')[0];
|
| 161 | + var tooltip = row.getValue('Tooltip')[0]; |
| 162 | + |
| 163 | + let idx = index; |
| 164 | + |
144 | 165 | if (latitude && longitude) {
|
145 | 166 | if (showMarkers) {
|
146 | 167 | markers.push({
|
147 | 168 | location: { lat: latitude, lng: longitude },
|
148 | 169 | iconSrc: this.isSelected(row) ? "https://js.devexpress.com/Demos/RealtorApp/images/map-marker.png" : null,
|
149 |
| - onClick: args => this._onClick(row), |
| 170 | + onClick: args => this._onClick(idx, row), |
| 171 | + tooltip: { |
| 172 | + text: tooltip |
| 173 | + }, |
150 | 174 | tag: row
|
151 | 175 | });
|
152 | 176 | }
|
153 | 177 | if (showRoutes) {
|
154 | 178 | routes.push([latitude, longitude]);
|
155 | 179 | }
|
156 | 180 | }
|
| 181 | + |
| 182 | + index++; |
157 | 183 | });
|
158 | 184 | }
|
159 | 185 | let autoAdjust = markers.length > 0 || routes.length > 0,
|
|
177 | 203 | opacity: 0.5,
|
178 | 204 | mode: '',
|
179 | 205 | locations: routes
|
180 |
| - }] : [] |
| 206 | + }] : [], |
181 | 207 | };
|
182 | 208 | if (changeExisting && this.mapViewer) {
|
183 | 209 | this.mapViewer.option(options);
|
|
0 commit comments