Reputation: 33
The commented out section does not work in IE, But does work in the other browsers.
IE errors on [query.outFields[1]] claiming it needs a string or a number. Any ideas why? Any ideas to how get IE to work with those commented lines?
var attS =
{
//[query.outFields[1]]: pin,
//[query.outFields[0]]: vars[0],
//[query.outFields[2]]: vars[5],
//[query.outFields[3]]: vars[6],
PIN: pin,
APN: vars[0],
PARCELAREA: vars[5],
AREATYPE: vars[6],
PARCELVER:working[0],
PERMITNUM:working[1],
ADDRESSID:working[2]
}
Here is the whole code block if you think it'll help..
for(j =0;j<multiPermit.length;j++)
{
var vars = multiPermit[j];
console.log(vars);
//center X
var x = vars[2];
//center Y
var y = vars[3];
var pin = vars[4];
//console.log(pin);
//Delete source geometry for multi point from final data to ensure it's not represented twice.
for(l=0;l<inputInfo.data.length;l++)
{
temp = inputInfo.data[l];
if(temp.attributes[query.outFields[0]]==vars[0] && temp.x == x && temp.y==y)
{
inputInfo.data.splice(l,1);
}
}
//var Test=query.outFields[1];
//console.log(Test);
for(var i=0; i<zipArray.length;i++)
{
var working = zipArray[i];
if(working[0]==vars[0])
{
var quickPush=inputInfo.data
var newX = x;
var newY = y;
var attS =
{
//[query.outFields[1]]: pin,
//[query.outFields[0]]: vars[0],
//[query.outFields[2]]: vars[5],
//[query.outFields[3]]: vars[6],
PIN: pin,
APN: vars[0],
PARCELAREA: vars[5],
AREATYPE: vars[6],
PARCELVER:working[0],
PERMITNUM:working[1],
ADDRESSID:working[2]
}
//console.log(attS);
quickPush.push({"x": newX,"y": newY,"attributes": attS})
}
}
}
Upvotes: 1
Views: 291
Reputation: 2783
I'm not 100% if I get your problem, but I think you're mixing 2 ways of defining properties of an object in javascript.
You are trying
var myObject = {
prop1 : value,
prop2 : value,
[prop3nameWhichIsPartOfOtherVar]: value
}
This is not possible (yet) on Internet explorer. A way to go around this is simply adding:
myObject[prop3nameWhichIsPartOfOtherVar] = value;
After your definition.
More information about what works or doesn't work (and the browser compatibilities): here
Upvotes: 1
Reputation: 943240
Computed property names ({ [likeThis]: "here" }
) are a new feature in EcmaScript 6 and are not supported by Internet Explorer yet.
You'll need to create your object and then add your variable fields afterwards.
var attS = {
PIN: pin,
APN: vars[0],
PARCELAREA: vars[5],
AREATYPE: vars[6],
PARCELVER: working[0],
PERMITNUM: working[1],
ADDRESSID: working[2]
};
attS[query.outFields[1]] = pin;
// etc
Upvotes: 2