1 Reply Latest reply: Feb 10, 2016 2:21 AM by MICHELE CATTELAN RSS

    Problem using SelectTextsInColumn

      Hi,
      I'm new in QlikView.
      I built an extension to display my stores on a map (using Leaflet) and I want to send the store name (row[2]) to QlikView when I doubleclick on the icon store.

      I tryed in this way:

       

      for (var i=0,k=_this.Data.Rows.length;i<k;i++){
             var row = _this.Data.Rows [i];

             var latitude = parseFloat(row[0].text.replace(",","."));
             var longitude = parseFloat(row[1].text.replace(",","."));
                 
             //Check to see coordinates are valid
              if (latitude != NaN && latitude !='' && latitude <= 90 && latitude >= -90 && longitude != NaN && longitude !='' && longitude <= 180 && latitude >= -180) {
              
               var latlng = new L.LatLng(latitude, longitude);
               var poptext = 'Lat & Long:'+latlng+'<br/>'+ row[2].text +'<br/>'+ 'Measure: ' + row[4].text;
               var marker = L.marker(latlng).addTo(map).bindPopup(poptext);
              
               marker.on('dblclick', function(e) {
                        _this.Data.SelectTextsInColumn(2, true, row[2].text);
                });
              
              } else {
               //Need to figure out a method of notifiying bad lat and longitudegs...
                 }   
           }
          
      Stores are corrected displayed in the map, but when I doubleclik, I send to QlikView always the last store fetched by the loop, not the selected one.
      What I'm doing wrong?
      Thanks in advance.

        • Re: Problem using SelectTextsInColumn

          I found the solution.

          The code (only the marker event) must be changed as below:

           

          marker.on('dblclick', function(e) {

                    _this.Data.SelectTextsInColumn(2, true, row[2].text);

                    var latSel = this.getLatLng().lat.toString().replace(".",",");

                    var lonSel = this.getLatLng().lng.toString().replace(".",",");

                    _this.Data.SelectTextsInColumn(0, true, latSel);

                    _this.Data.SelectTextsInColumn(1, true, lonSel);

                    });

           

          Now it works correctly.