cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Example of creating and populating an INFOTABLE in a client side widget

cdsouza
5-Regular Member

Example of creating and populating an INFOTABLE in a client side widget

I'm looking for an example of how to create and populate (LOCATION) entries in an INFOTABLE via the client-side widget (widget.runtime.js).

Thanks!

Cletus

1 ACCEPTED SOLUTION

Accepted Solutions
cdsouza
5-Regular Member
(To:cdsouza)

The following code snippet works for me.  Lines 1-16 create an infotable.  18-35 (really 27-32) populate the infotable with data.

var infoTable = new Object();

infoTable = {

    'dataShape': {

        fieldDefinitions: {},

        name: 'RegionLocations',

        description: 'Google Maps Region Locations'

        },

    'name': 'Region',

    'description': 'Google Maps Region',

    'rows': [{}]

};   

infoTable.dataShape.fieldDefinitions['Location'] = {

    name: 'Location',

    baseType: 'LOCATION'

};

for( var i = 0; i < latLngArray.length; i++ )

{

    var latLng = latLngArray;

    var newLocation = new Object();

    newLocation.latitude = latLng.lat();

    newLocation.longitude = latLng.lng();

    newLocation.elevation = 0;

    newLocation.units = 'WGS84';               

    var newRow = {};

    infoTable.rows.push(newRow);

    var row = infoTable.rows;

    newRow['Location'] = newLocation;

    infoTable.rows = newRow;

    delete row;

}

View solution in original post

1 REPLY 1
cdsouza
5-Regular Member
(To:cdsouza)

The following code snippet works for me.  Lines 1-16 create an infotable.  18-35 (really 27-32) populate the infotable with data.

var infoTable = new Object();

infoTable = {

    'dataShape': {

        fieldDefinitions: {},

        name: 'RegionLocations',

        description: 'Google Maps Region Locations'

        },

    'name': 'Region',

    'description': 'Google Maps Region',

    'rows': [{}]

};   

infoTable.dataShape.fieldDefinitions['Location'] = {

    name: 'Location',

    baseType: 'LOCATION'

};

for( var i = 0; i < latLngArray.length; i++ )

{

    var latLng = latLngArray;

    var newLocation = new Object();

    newLocation.latitude = latLng.lat();

    newLocation.longitude = latLng.lng();

    newLocation.elevation = 0;

    newLocation.units = 'WGS84';               

    var newRow = {};

    infoTable.rows.push(newRow);

    var row = infoTable.rows;

    newRow['Location'] = newLocation;

    infoTable.rows = newRow;

    delete row;

}

Top Tags