I'm trying to modify this code example for dynamic info windows to work for images instead of text:
https://developers.google.com/fusiontables/docs/samples/change_infowindow_content
I know that I can use this:
text
to make the images come up as links that open a new page using the Fusion Table custom InfoWindow UI, but some of the cells in my Fusion Table have an image URL, and others are empty. I want the InfoWindow to leave out the image link if there is no URL in the cell. Since I can't code this using the Fusion Table UI, I was wondering if it is possible to use the Fusion Tables Layer in the Google Maps API and modify this section of code:
// If the delivery == yes, add content to the window
if (e.row['delivery'].value == 'yes') {
e.infoWindowHtml += "Delivers!";
}
to test for the image URL instead testing for "yes"?? I would like the InfoWindow to display the link to the image if it is there, and I would like the link to be left out if the cell is empty.
Here is a link to my Fusion Table:
https://www.google.com/fusiontables/DataSource?docid=15wosKAeHC0gcpU_N6UPbxPL09RrEBKlQNEaCmnU#map:id=3
I would like to test all cells in the "y2012" column.
Any ideas??
You can also use what we call dynamic templating for the info windows. This lets you Closure Template syntax in an info window, including exactly your case of leaving out empty fields.
This should work in a click event listener on the layer:
// If the y2012 != "", add open the picture
if (e.row['y2012'].value != '') {
window.open(e.row['y2012'].value);
}
example
Related
Good morning,
I have a spreadsheet that currently doesn't have any data in it, only headers.
If I put some dummy data in it, the fields are pulled in with no problem and charts display properly in google studio dash. However, if I remove the data and keep only the headers (waiting for the user to input data entry), all the charts utilizing the particular sheet show 'Chart Configuration Incomplete'. When I view the data source and refresh it, it states all the fields are missing. Only if there is an entry in addition to the headers, the fields show and charts work as expected. Is there a way around this by chance? Why can't the charts just show blank? I have the 'First Row as Headers' selected.
Try adding a row of dummy data (so all the fields will be added to your source) but then adding a report filter to exclude that entry from the report. You are correct that Data Studio won’t recognize empty fields when creating the data source.
I have a database of elements, each element has its own QR Code. After reading the code I would like to be able to open the worksheet on a specific tab and jump to the appropriate cell (according to the element name). Calling a worksheet through a URL with the #gid parameter allows you to open a tab.... the "range" parameter allows you to jump to a specific cell.... and what if I want to search for an item by name? Something like: https://docs.google.com/spreadsheets/d/1fER4x1p.../edit#gid=82420100&search=element_name.... is it possible?
Google has not introduced this yet
But you can look into Google Script (Googles SpreadSheets macros like) to achieve this.
Also a simpler approach will be to just filter the data, but this will change your requirement obviously. For example you can create a Filter with the name you are looking for and then you will get the URL.
This is the URL to a Sample of this, it should open the
Spreadsheet and filter the data when loaded. This is the Icon to
look for to create the filters
here is some documentation for you to get started on Google App Script, but I don't have a direct link to let you know how to catch the parameters for it to process them. What I can tell you is that this is a much more complicated approach than just a URL because it involves programmatic processing on the Spreadsheet side.
For a tag system, when entering a new item, I'd like the user to start typing a letter or two and see possible tags...similar to how SO tags work on the website i.e. Ajax.
Is there a way to do this on IOS?
Basically the Add Item screen has some empty text fields where you put the name etc.
I'd like to have an additional empty field where as you enter letters you see possible tags appear below and can then select one to tag the item.
The tags would be served from an entity or table so there would have to be a call to core data to supply them based on the letters typed.
Do I have to implement a full blown tableview to do this? Or is there a way to make the possible tags show up below the textfield box.
Thanks for any suggestions.
You could try a third party development in order to make what you want. In a recent project I have used this one:
https://github.com/EddyBorja/MLPAutoCompleteTextField
I'm trying to build a dashboard using highcharts.js(multiple charts are displayed on a page), the data for these charts are fetched via ajax. Each of these charts can be refreshed independently. Initially when I was trying to get this working I was getting error #16 and I figured out that HighCharts.js was included and the ajax response was sending back HighCharts again and hence this error was being thrown by HighCharts.
To circumvent this I added js code to check if HighCharts was already defined and if it was I set it to null
if(window.Highcharts){
window.Highcharts = null;
}
This seemed to solve the problem, but however I now see that when I refresh one chart the other chart(s) on the dashboard seem to have some rendering issues - a part of the other chart(s) seems to have been stripped off.
Please let me know if what I'm doing is right, also please let me know a better way in which I can avoid loading HighCharts is its already loaded.
Assuming you have control over the HTML you're rendering, you need to do either;
Place highcharts (and other scripts) as a dependency in the page container so that you're sure it loads only once.
Conditionally load HighCharts dynamically rather than statically.
Eg something like this;
function buildChart(func) {
if (window.Highcharts === undefined) {
console.log("Highcharts is not loaded, fetching...");
$.getScript("http://code.highcharts.com/highcharts.js", function () {
alert("HighCharts was loaded");
func(); // build chart
});
}
else {
console.log("HighCharts was already loaded");
func(); // build chart
}
}
// test
buildChart(function () {
// build chart
console.log("Read to build chart with:", window.Highcharts);
})
However, this simple example doesn't cater for concurrent requests whilst highcharts is still being loaded. So for conditional loading like this, I would look into using a library like RequireJS, YepNope or HeadJS which can handle these dependencies for you. You are then able to include the HighCharts script in your components as often as you like and they'll only be loaded once.
Why are you loading highcharts with each span? You only need to load it once when the document loads.
Highcharts does not need to load each time a chart is refreshed...it's already there.
All you need to do to refresh individual charts via ajax is return a json object of the data for that chart, and re initialize the chart with the existing options that were set when the page loaded.
The scenario:
I have an ApEx page which pulls a record from a table. The record contains an id, the name of the chart (actually a filename) and the code for an image map as an NVARCHAR2 column called image_map.
When I render the page I have an embedded HTML region which pulls the image in using the #WORKSPACE_IMAGES#&P19_IMAGE. substitution as the src for the image.
Each chart has hot spots (defined in the image_map html markup) which point to other charts on the same ApEx page. I need to embed the:
Application ID (like &APP_ID.)
Session (like &APP_SESSION.)
My problem:
When I try to load the &APP_ID as part of the source into the database it pre-parses it and plugs in the value for the ApEx development app (e.g. 4500) instead of the actual target application (118).
Any help would be greatly appreciated.
Not a lot of feedback - guess I'm doing something atypical?
In case someone else is trying to do this, the workaround I ended up using was to have a javascript run and replace some custom replacement flags in the urls. The script is embedded in the template of the page and assigns the APEX magic fields to local variables, e.g.:
var my_app_id = '&APP_ID';
Not pretty, but it works...
Ok - I think I've left this open long enough... In the event that anyone else is trying to (mis)use apex in a similar way, it seems like the "apex way" is to use dynamic actions (which seem stable from 4.1.x) and then you can do your dynamic replace from there rather than embedding js in the page(s) themselves.
This seems to be the most maintainable, so I'll mark this as the answer - but if someone else has a better idea, I'm open to education!
I found it difficult to set a dynamic URL on a link to another page - directly - attempting to include the full URL as an individual link target doesn't work, at least in my simplistic world, I'm not an expert (as AJ said: any wisdom appreciated).
Instead, I set individual components of the url via the link, and a 'Before Header' PL/SQL process on the targeted page to combine the elements into a full url and assign it to the full url page-item:
APEX_UTIL.set_session_state(
'PG_FULL_URL',
'http...'||
v('PG_URL_COMPONENT1')||
v('PG_URL_COMPONENT2')||
'..etc..'
);
...where PG_FULL_URL is an item of Type 'Display Image', 'Based On' 'Image URL stored in Page Item Value'.
This is Apex 5.1 btw, I don't know if some of these options are new in this release.