While exporting as csv file, file is getting downloaded but with name download and with no extension - csv

While exporting as csv file, file is getting downloaded but with name as download and with no extension,
I tried searching solution but didn't got any.
below is the code. If I rename the file and save as csv it shows the correct data
_addPrintButton: function() {
var me = this;
this.down('#print_button_box').add( {
xtype: 'rallybutton',
itemId: 'print_button',
text: 'Export to Excel',
disabled: false,
margin: '20 10 10 0',
region: "right",
handler: function() {
me._onClickExport();
}
});
},
_onClickExport: function(){
var grid = this.down('#grid_box');
var data = this._getCSV(grid.items.items[0]);
window.location = 'data:text/csv;charset=utf8,' + encodeURIComponent(data);
//Ext.getBody().unmask();
},
_getCSV: function (grid) {
var cols = grid.columns;
var store = grid.store;
var data = '';
var that = this;
_.each(cols, function(col, index) {
data += that._getFieldTextAndEscape(col.text) + ',';
});
data += "\r\n";
_.each(that.records, function(record) {
_.each(cols, function(col, index) {
var text = '';
var fieldName = col.dataIndex;
text = record[fieldName];
if (text || text == 0) {
//text = record[fieldName];
data += that._getFieldTextAndEscape(text) + ',';
}
/*else if (fieldName === "Project" ) {
text = record[fieldName];
}
else if (fieldName === "Case") {
var size = _.size(record[fieldName]);
for (var i = 0; i < size; i++){
text = record[fieldName][i]
}
}*/
});
data += "\r\n";
});
return data;
},
_getFieldTextAndEscape: function(fieldData) {
var string = this._getFieldText(fieldData);
return this._escapeForCSV(string);
},
_getFieldText: function(fieldData) {
var text;
if (fieldData === null || fieldData === undefined) {
text = '';
} else if (fieldData._refObjectName) {
text = fieldData._refObjectName;
}else {
text = fieldData;
}
return text.toString();
},
_escapeForCSV: function(string) {
if (string.match(/,/)) {
if (!string.match(/"/)) {
string = '"' + string + '"';
} else {
string = string.replace(/,/g, '');
}
}
return string;
},

You're searching at the wrong place.
The web server has to add HTTP header Content-Disposition to indicate the recommended file name, e.g.
Content-Disposition: attachment; filename="correct_data.csv"

Related

My website becomes unresponsive when dealing 1000 rows excel file

I am uploading data from an excel file into my website using input html button.
and then convert the data into json and then I map it with local external metadata.
Finally view it using the id.
My website becomes unresponsive & sometimes takes a lot of time processing. Please help
function ExportToTable() {
var regex = /^([a-zA-Z0-9\s_\\.\-:()])+(.xlsx|.xls)$/;
/*Checks whether the file is a valid excel file*/
if (regex.test($("#excelfile").val().toLowerCase())) {
var xlsxflag = false; /*Flag for checking whether excel is .xls format or .xlsx format*/
if ($("#excelfile").val().toLowerCase().indexOf(".xlsx") > 0) {
xlsxflag = true;
}
/*Checks whether the browser supports HTML5*/
if (typeof (FileReader) != "undefined") {
var reader = new FileReader();
reader.onload = function (e) {
var data = e.target.result;
/*Converts the excel data in to object*/
if (xlsxflag) {
var workbook = XLSX.read(data, { type: 'binary' });
}
else {
var workbook = XLS.read(data, { type: 'binary' });
}
/*Gets all the sheetnames of excel in to a variable*/
var sheet_name_list = workbook.SheetNames;
console.log(sheet_name_list);
var cnt = 0; /*This is used for restricting the script to consider only first
sheet of excel*/
sheet_name_list.forEach(function (y) { /*Iterate through all sheets*/
/*Convert the cell value to Json*/
if (xlsxflag) {
var exceljson = XLSX.utils.sheet_to_json(workbook.Sheets[y]);
}
else {
var exceljson = XLS.utils.sheet_to_row_object_array(workbook.Sheets[y]);
}
//Download & View Subscriptions
if (exceljson.length > 0 && cnt == 1) {
metadata = [];
fetch("metadata.json")
.then(response => response.json())
.then(json => {
metadata = json;
console.log(metadata);
user_metadata1 = [], obj_m_processed = [];
for (var i in exceljson) {
var obj = { email: exceljson[i].email, name: exceljson[i].team_alias, id: exceljson[i].autodesk_id };
for (var j in metadata) {
if (exceljson[i].email == metadata[j].email) {
obj.GEO = metadata[j].GEO;
obj.COUNTRY = metadata[j].COUNTRY;
obj.CITY = metadata[j].CITY;
obj.PROJECT = metadata[j].PROJECT;
obj.DEPARTMENT = metadata[j].DEPARTMENT;
obj.CC=metadata[j].CC;
obj_m_processed[metadata[j].email] = true;
}
}
obj.GEO = obj.GEO || '-';
obj.COUNTRY = obj.COUNTRY || '-';
obj.CITY = obj.CITY || '-';
obj.PROJECT = obj.PROJECT || '-';
obj.DEPARTMENT = obj.DEPARTMENT || '-';
obj.CC = obj.CC || '-';
user_metadata1.push(obj);
}
for (var j in metadata) {
if (typeof obj_m_processed[metadata[j].email] == 'undefined') {
user_metadata1.push({ email: metadata[j].email, name: metadata[j].name, id: metadata[j].autodesk_id,
GEO: metadata[j].GEO,
COUNTRY : metadata[j].COUNTRY,
CITY : metadata[j].CITY,
PROJECT : metadata[j].PROJECT,
DEPARTMENT : metadata[j].DEPARTMENT,
CC:metadata[j].CC
});
}
}
document.getElementById("headings4").innerHTML = "MetaData Mapping";
BindTable(user_metadata1, '#user_metadata1
cnt++;
});
$('#exceltable').show();
}
if (xlsxflag) {/*If excel file is .xlsx extension than creates a Array Buffer from excel*/
reader.readAsArrayBuffer($("#excelfile")[0].files[0]);
}
else {
reader.readAsBinaryString($("#excelfile")[0].files[0]);
}
}
else {
alert("Sorry! Your browser does not support HTML5!");
}
}
else {
alert("Please upload a valid Excel file!");
}
}
Here is how the json is bind after mapping metadata
function BindTable(jsondata, tableid) {/*Function used to convert the JSON array to Html Table*/
var columns = BindTableHeader(jsondata, tableid); /*Gets all the column headings of Excel*/
for (var i = 0; i < jsondata.length; i++) {
var row$ = $('<tr/>');
for (var colIndex = 0; colIndex < columns.length; colIndex++) {
var cellValue = jsondata[i][columns[colIndex]];
if (cellValue == null)
cellValue = "";
row$.append($('<td/>').html(cellValue));
}
$(tableid).append(row$);
}
}
function BindTableHeader(jsondata, tableid) {/*Function used to get all column names from JSON and bind the html table header*/
var columnSet = [];
var headerTr$ = $('<tr/>');
for (var i = 0; i < jsondata.length; i++) {
var rowHash = jsondata[i];
for (var key in rowHash) {
if (rowHash.hasOwnProperty(key)) {
if ($.inArray(key, columnSet) == -1) {/*Adding each unique column names to a variable array*/
columnSet.push(key);
headerTr$.append($('<th/>').html(key));
}
}
}
}
$(tableid).append(headerTr$);
return columnSet;
}

Vue Export JSON to csv file

I am trying to export JSON to a CSV file.
Previously I'm using this code below to export:
convertToCSV(objArray: any) {
var array = typeof objArray != "object" ? JSON.parse(objArray) : objArray;
var str = "";
for (var i = 0; i < array.length; i++) {
var line = "";
for (var index in array[i]) {
if (line != "") line += ",";
line += array[i][index];
}
str += line + "\r\n";
}
return str;
}
exportCSVFile(headers: any, items: any[], fileTitle: string) {
if (headers) {
items.unshift(headers);
}
// Convert Object to JSON
var jsonObject = JSON.stringify(items);
var csv = this.convertToCSV(jsonObject);
var exportedFilenmae = fileTitle + ".csv" || "export.csv";
var blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });
if (navigator.msSaveBlob) {
// IE 10+
navigator.msSaveBlob(blob, exportedFilenmae);
} else {
var link = document.createElement("a");
if (link.download !== undefined) {
// feature detection
// Browsers that support HTML5 download attribute
var url = URL.createObjectURL(blob);
link.setAttribute("href", url);
link.setAttribute("download", exportedFilenmae);
link.style.visibility = "hidden";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
}
}
exportcsv() {
this.data.forEach((item) => {
this.itemsFormatted.push({
meteringpoint: item.meteringpoint.replace(/,/g, ""), // remove commas to avoid errors,
group: item.group,
instdevice: item.instdevice,
floor: item.floor,
room: item.room,
section: item.section,
});
});
var fileTitle = "Metering Point View"; // or 'my-unique-title'
this.exportCSVFile(this.headerCSV, this.itemsFormatted, fileTitle);
}
}
But there's an error with Property 'msSaveBlob' does not exist on type 'Navigator'
Here is what I found on the internet regarding the error
So I want to ask if there is any library for exporting that has a typescript definition or is there any workaround for the problem on the code above.
Most of the libraries i found will have this problem whereby Could not find a declaration file for module 'vue-json-to-csv'. 'd:/Project/Ivory-Leaf/OAMR/VueFrontEndUi/vuefrontendui/node_modules/vue-json-to-csv/dist/vue-json-to-csv.js' implicitly has an 'any' type. Try `npm i --save-dev #types/vue-json-to-csv` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue-json-to-csv';

How to prevent my github page from making post title 'title-cased'

I have created a github page and have chosen one of proposed Jekyll themes called minima. To add a post I have created a file called 2018-11-16-My-first-post-on-github.md. However, the post title displayed is a text converted to title case: My First Post On Github, so every first letter in each word is made upper case. How can I prevent that? Is this theme-dependent?
exports.toTitleCase = function(str){
var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
return (str+'').replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function(match, index, title){
if (index > 0 && index + match.length !== title.length &&
match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" &&
(title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') &&
title.charAt(index - 1).search(/[^\s-]/) < 0) {
return match.toLowerCase();
}
if (match === 'tus') {
return match;
}
if (match.substr(1).search(/[A-Z]|\../) > -1) {
return match;
}
// Avoid uppercasing 'mod_deflate', apt-file - kvz
if (match.match(/.[\_\-\/\d]./)) {
return match;
}
// Avoid uppercasing '`frame`', '/sftp/import' - kvz
if (match.match(/(^[`\/]|[`]$)/)) {
return match;
}
// Avoid uppercasing: 'tmpfs' or anything that doesn't have a vowel - kvz
if (!match.match(/[aeiou]/)) {
return match;
}
return match.charAt(0).toUpperCase() + match.substr(1);
});
};
exports.newPost = function (content, opts, cb){
var self = this;
var matches = [];
var oldTitle = '';
var newTitle = '';
var oldLine = '';
var heading = '';
var newLine = '';
var changes = [];
var words = [];
var frontMatter = content.split('---')[1];
if (frontMatter) {
matches = frontMatter.match(/^(title\s*:\s*)\"?(.+?)\"?[\ \t]*$/im);
oldTitle = matches[2];
newTitle = self.toTitleCase(oldTitle).trim();
oldLine = matches[0];
newLine = matches[1] + '"' + newTitle + '"';
if (oldLine !== newLine) {
changes.push({oldTitle: oldTitle, newTitle: newTitle});
content = content.replace(oldLine, newLine);
}
}
if (opts.body === true) {
matches = content.match(/^\#{1,6} ([a-zA-Z0-9\-\;\!\?\%\&\;\:\.\/\(\)\ ]+)$/mg)
for (var i in matches) {
words = matches[i].split(' ')
heading = words.shift();
oldTitle = words.join(' ');
newTitle = self.toTitleCase(oldTitle).trim();
oldLine = heading + ' ' + oldTitle;
newLine = heading + ' ' + newTitle;
if (oldLine !== newLine) {
changes.push({oldTitle: oldTitle, newTitle: newTitle});
content = content.replace(oldLine, newLine);
}
}
}
if (changes.length === 0) {
content = null;
}
return cb(null, content, changes);
};
Jekyll automatically converts your post title to uppercase upon import. You can fix this by using a plugin, or by using a YAML file or Front matter to specify your title value directly.

How to convert formatted text to html tag in Google-apps-script?

I want to convert a formatted text in a cell to html but I don't know how to read the format of the text.
Let's say that I have the following text in a cell:
A text with a bold word.
And I would like to convert it in an other cell to:
A text with a <b>bold</b> word.
How can I do that?
I didn't find anything useful in the Spreadsheet API to read format info...Does anyone have any tips?
Thanks.
EDIT: I've created a feature request. Please vote to have the feature.
My Google Script
/**
* Rich Text to HTML.
* #param {string} qRange Input text.
* #returns {string} Text as HTML.
* #customfunction
*/
function RICHTEXT_TO_HTML(qRange) {
var indexBool = false;
var indexItalic = false;
var indexUnderline = false;
var indexStrikethrough = false;
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var range = sheet.getRange(qRange);
var cell = range;
var cellValue = cell.getRichTextValue();
var txt = String(cell.getDisplayValue());
var styles = cell.getTextStyles();
var result = '';
for (var i = 0; i < txt.length; i++) {
var style = cellValue.getTextStyle(i, i + 1);
if (!indexStrikethrough && style.isStrikethrough()) {
indexStrikethrough = true;
result += '<strike>';
} else if (indexStrikethrough && !style.isStrikethrough()) {
indexStrikethrough = false;
result += '</strike>';
}
if (!indexUnderline && style.isUnderline()) {
indexUnderline = true;
result += '<u>';
} else if (indexUnderline && !style.isUnderline()) {
indexUnderline = false;
result += '</u>';
}
if (!indexBool && style.isBold()) {
indexBool = true;
result += '<b>';
} else if (indexBool && !style.isBold()) {
indexBool = false;
result += '</b>';
}
if (!indexItalic && style.isItalic()) {
indexItalic = true;
result += '<i>';
} else if (indexItalic && !style.isItalic()) {
indexItalic = false;
result += '</i>';
}
result += txt[i];
}
if (indexStrikethrough) {
result += '</strike>';
}
if (indexUnderline) {
result += '</u>';
}
if (indexBool) {
result += '</b>';
}
if (indexItalic) {
result += '</i>';
}
return result;
}
Usage
A1 = "My formatted example!!!"
A2 = =RICHTEXT_TO_HTML("A1")
A2 Result = My <i>formatted</i> <b>example</b>!!!
Working example
https://docs.google.com/spreadsheets/d/1mVvE8AdXYKSnaSIfRBrjfOeXxmTkVZovhguMZ3sc47M/edit?usp=sharing
I went ahead and updated this idea to better reflect how we do this is 2021.
/**
* #Author: Emma Sargent
* Rich Text to HTML.
* #param {Range} Google Sheets Range object
* #returns {string} Text as HTML.
* #customfunction
*/
function richTextToHtml(range) {
const runs = range.getRichTextValue().getRuns();
const formattedRuns = runs.map((run) => {
const attr = {
style: '',
};
const text = run.getText();
const link = run.getLinkUrl();
let parentTag = 'span';
if (link) {
parentTag = 'a';
attr.href = link;
}
const style = run.getTextStyle();
const styles = {
'font-family': `'${style.getFontFamily()}'`,
'font-size': `${style.getFontSize()}px`,
color: style.getForegroundColor(),
};
attr.style = Object.entries(styles)
.map(([key, val]) => `${key}: ${val}`)
.join('; ');
let tags = [];
if (style.isBold()) {
tags.push('b');
}
if (style.isItalic()) {
tags.push('i');
}
if (style.isUnderline()) {
tags.push('u');
}
if (style.isStrikethrough()) {
tags.push('strike');
}
const headTags = tags.length ? `<${tags.join('><')}>` : '';
const closeTags = tags.length ? `</${tags.join('></')}>` : '';
const attrStr = Object.entries(attr)
.map(([key, val]) => `${key}="${val}"`)
.join(' ');
const mainTag = `<${parentTag} ${attrStr}>${headTags}${text}${closeTags}</${parentTag}>`;
const lineBreakFormattedStr = mainTag.replace(/[\r\n]/g, '<br>');
return lineBreakFormattedStr;
});
return formattedRuns.join('');
}
And because someone emailed me and asked, here's a version that can be run as a custom function from the formula bar.
Spreadsheet formula: =richTextToHtml("YourSheetName!A1NotationRange")
function richTextToHtml(rangeStr) {
let [sheetName, rangeName] = rangeStr.split("!");
sheetName = sheetName.replaceAll("'",'');
const range = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName).getRange(rangeName);
const runs = range.getRichTextValue().getRuns();
const formattedRuns = runs.map((run) => {
const attr = {
style: '',
};
const text = run.getText();
const link = run.getLinkUrl();
let parentTag = 'span';
if (link) {
parentTag = 'a';
attr.href = link;
}
const style = run.getTextStyle();
const styles = {
'font-family': `'${style.getFontFamily()}'`,
'font-size': `${style.getFontSize()}px`,
color: style.getForegroundColor(),
};
attr.style = Object.entries(styles)
.map(([key, val]) => `${key}: ${val}`)
.join('; ');
let tags = [];
if (style.isBold()) {
tags.push('b');
}
if (style.isItalic()) {
tags.push('i');
}
if (style.isUnderline()) {
tags.push('u');
}
if (style.isStrikethrough()) {
tags.push('strike');
}
const headTags = tags.length ? `<${tags.join('><')}>` : '';
const closeTags = tags.length ? `</${tags.join('></')}>` : '';
const attrStr = Object.entries(attr)
.map(([key, val]) => `${key}="${val}"`)
.join(' ');
const mainTag = `<${parentTag} ${attrStr}>${headTags}${text}${closeTags}</${parentTag}>`;
const lineBreakFormattedStr = mainTag.replace(/[\r\n]/g, '<br>');
return lineBreakFormattedStr;
});
return formattedRuns.join('');
}
Demo sheet here: https://docs.google.com/spreadsheets/d/1X8I_lRXwoUXWRKb2hZPztDIPRs2nmXGtOuWmnrKWjAg/edit?usp=sharing
Thank you Eduardo Cuomo for the answer. I wanted to add the code to get down to the bottom line with a little fix.
/**
* #Author: Eduardo Cuomo
* Rich Text to HTML.
* #param {string} qRange Input text.
* #returns {string} Text as HTML.
* #customfunction
*/
function RICHTEXT_TO_HTML(qRange) {
var indexBool = false;
var indexItalic = false;
var indexUnderline = false;
var indexStrikethrough = false;
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var range = sheet.getRange(qRange);
var cell = range;
var cellValue = cell.getRichTextValue();
var txt = String(cell.getDisplayValue());
var styles = cell.getTextStyles();
var result = '';
for (var i = 0; i < txt.length; i++) {
if(txt[i]=="\n"){
result += '<br>';
}else{
var style = cellValue.getTextStyle(i, i + 1);
if (!indexStrikethrough && style.isStrikethrough()) {
indexStrikethrough = true;
result += '<strike>';
} else if (indexStrikethrough && !style.isStrikethrough()) {
indexStrikethrough = false;
result += '</strike>';
}
if (!indexUnderline && style.isUnderline()) {
indexUnderline = true;
result += '<u>';
} else if (indexUnderline && !style.isUnderline()) {
indexUnderline = false;
result += '</u>';
}
if (!indexBool && style.isBold()) {
indexBool = true;
result += '<b>';
} else if (indexBool && !style.isBold()) {
indexBool = false;
result += '</b>';
}
if (!indexItalic && style.isItalic()) {
indexItalic = true;
result += '<i>';
} else if (indexItalic && !style.isItalic()) {
indexItalic = false;
result += '</i>';
}
result += txt[i];
}
}
if (indexStrikethrough) {
result += '</strike>';
}
if (indexUnderline) {
result += '</u>';
}
if (indexBool) {
result += '</b>';
}
if (indexItalic) {
result += '</i>';
}
return result;
}
Here's a version that creates more compact HTML (avoiding lots of spans setting styles):
function richTextToHtml(range) {
let lastFont = null, lastSize = null, lastColor = null, lastLink = null;
let parentClose = '';
return range.getRichTextValue()
.getRuns()
.map(run => {
const text = run.getText().replace(/[\r\n]/g, '<br>');
const style = run.getTextStyle();
const font = style.getFontFamily();
const size = style.getFontSize();
const color = style.getForegroundColor();
const link = run.getLinkUrl();
let mainTag = '';
if (font !== lastFont || size !== lastSize || color !== lastColor || link !== lastLink) {
mainTag += parentClose;
mainTag += link ? `<a href="${link}"` : '<span';
mainTag +=
` style="font-family:'${font}';font-size:${size}px;color:${color}">`;
parentClose = link ? '</a>' : '</span>';
lastFont = font;
lastSize = size;
lastColor = color;
lastLink = link;
}
let closeTags = '';
Object.entries({isBold: 'b', isItalic: 'i', isUnderline: 'u', isStrikethrough: 'strike'})
.filter(([getter, tag]) => style[getter]())
.forEach(([getter, tag]) => {
mainTag += `<${tag}>`;
closeTags = `</${tag}>${closeTags}`;
});
return `${mainTag}${text}${closeTags}`;
})
.join('') + parentClose;
}
You need to use getFontWeight properties of the Range to read these formating values. Example given here: GAS-check-cell-format
Check Rucent88's answer.

Google Api Nearby Places on change of type, layer removed, but advertising stays, how can I remove the complete layer without reloading the page

I have custom code to create a nearby search of places on google map.
Each search type creates a new layer, removed when selecting a different search type, my problem is, even thought he layer is removed, here in Thailand we have "Google partners advertising" show dependant on the search type and this "Layer" doesnt get removed, but added to when creating a new search layer.
This is the code I use to create the search (in part):
Creating a layer (Google):
<div id="map_layers_google">
<input type="checkbox" name="map_google" id="map_google_restaurant" class="box" onclick="Propertywise.Maps.getDataWithinBounds('google_restaurant');" value="google_restaurant">
</div>
getDataWithinBounds: function(layer_name, except_this_area) {
if (!Propertywise.Design.is_ie8_or_less) {
this.layers_on_map[layer_name] = true;
this.getEntitiesWithinBounds(layer_name);
}
getEntitiesWithinBounds: function(entity_name) {
var $this = this;
if (!this.getBounds()) {
setTimeout(function() {
$this.getEntitiesWithinBounds(entity_name);
}, 20);
} else {
var layer_name, category;
var $this_input_el = jQuery("#map_" + entity_name);
jQuery("#map_updating").fadeIn('fast');
if (entity_name.indexOf('google') != -1) {
layer_name = "google";
category = entity_name.replace("google_", "");
} else if (entity_name.indexOf('school') != -1) {
layer_name = "schools";
category = entity_name.replace("schools_", "");
} else if (entity_name.indexOf('events') != -1) {
layer_name = "events";
category = entity_name.replace("events_", "");
} else {
layer_name = "transport";
this.toggleTransitLayer();
}
jQuery("#map_layers_" + layer_name + " input").each(function(index, value) {
var el_id = jQuery(this).attr("id");
var el_entity_name = el_id.replace("map_", "");
Propertywise.Maps.layers_on_map[el_entity_name] = false;
if (jQuery(this).is(":checked") && el_entity_name != entity_name) {
jQuery(this).attr("checked", false);
}
if (jQuery(this).is(":checked") && el_entity_name == entity_name) {
Propertywise.Maps.layers_on_map[entity_name] = true;
}
});
if (jQuery("#map_" + entity_name).is(':checked') || Propertywise.this_page == "school") {
if (layer_name == "google") {
infoWindow = new google.maps.InfoWindow();
Propertywise.Maps.removeMarkers(layer_name);
var request = {
bounds: Propertywise.Maps.map.getBounds(),
types: [category]
};
service = new google.maps.places.PlacesService(Propertywise.Maps.map);
service.radarSearch(request, function(results, status) {
jQuery("#map_updating").fadeOut('fast');
if (status != google.maps.places.PlacesServiceStatus.OK) {
return;
}
for (var i = 0, result; result = results[i]; i++) {
Propertywise.Maps.createMarker(result.geometry.location.lat(), result.geometry.location.lng(), {
place: result,
type: category
});
}
});
}
} else {
this.removeMarkers(layer_name);
jQuery("#map_updating").fadeOut('fast');
}
}
}
And this is the setup and remove each layer:
setUpLayers: function() {
var $this = this;
jQuery.each(this.layers, function(layer_name, value) {
Propertywise.Ajax.requests[layer_name] = [];
$this.layers[layer_name] = [];
});
},
removeMarkers: function(layer_name) {
if (Propertywise.Maps.map) {
var layer = this.layers[layer_name];
for (var i = 0; i < layer.length; i++) {
layer[i].setMap(null);
}
layer = [];
}
}
Here is link to screen shot of the problem.
screenshot
Question is, can anyone help with either changing the above to remove the complete layer(not just marker layer) or advise how to remove the advertising.. I understand this is part of terms of Google to display, but its unprofessional and looks terrible.
Best
Malisa