leaflet geocsv filter on the first columns only

213 Views Asked by At

I'm using leaflet and geocsv to build a map. I'm working from the nice work from perrygeo (https://github.com/perrygeo/leaflet-simple-csv).

I have a problem with the filter container. Indeed i want to show images in my popup, so i have columns in my CSV files with html code ("<"img src=....">"). No pb with my popup, i have all my informations and my images. But when i use the filter container, i can see the "<"img src=....">" as a proposition. I'd like to use "the populateTypeAhead(csv, delimiter)" function but only on my first columns (name, city).

This is the function

function populateTypeAhead(csv, delimiter) {
var lines = csv.split("\n");
for (var i = lines.length - 1; i >= 1; i--) {
    var items = lines[i].split(delimiter);
    for (var j = items.length - 1; j >= 0; j--) {
        var item = items[j].strip();
        item = item.replace(/"/g,'');
        if (item.indexOf("http") !== 0 && isNaN(parseFloat(item))) {
            typeAheadSource.push(item);
            var words = item.split(/\W+/);
            for (var k = words.length - 1; k >= 0; k--) {
                typeAheadSource.push(words[k]);
            }
        }
    }
}
}

Any idea?

0

There are 0 best solutions below