The issue may be a race condition. You see the page well loaded but
when exhibit loads programmatically, the sources of the page could not
be loaded and you must control the load process.
What about if you load the exhibit lib with "?autoCreate=false" and
then you run "Exhibit.autoCreate()" programatically fired by a page
event ("staticComponentsRegistered.exhibit") Look at
https://github.com/simile-widgets/exhibit/wiki/Scripted-Event-APIIf csv version works fine in a simplified example (the one I wrote) it must work too in your complex site, but there are other factors, i.e. to load exhibit lib by a php function. Best, -- luismiguel (@lmorillas) El dom, 19 sept 2021 a las 1:18, jjon (<[email protected]>) escribió: > > Luis, Daniel, David, et al. > In the context of my WordPress site, I have a functions.php file that loads > the locally held simile software up front, thus: > ``` > function my_scripts_method() { > wp_enqueue_script( 'exhibit-api.js', get_stylesheet_directory_uri() . > '/js/exhibit-dist/exhibit-api.js?bundle=false'); > wp_enqueue_script( 'more_custom_JS', get_stylesheet_directory_uri() . > '/js/custom-scripts/customscripts.js', array( 'jquery' )); > } > add_action( 'wp_enqueue_scripts', 'my_scripts_method' ); > ``` > > This works fine: Exhibit is loaded and appears to be complete and correct. I > did try commenting out that php and putting the simile-widgets.org link in > the <head/> of the page instead: ```<script > src="//api.simile-widgets.org/exhibit/current/exhibit-api.js"></script>```. > This works fine too but no matter what the source of the exhibit code, and no > matter what the data, I still keep getting the ```TypeError: > Exhibit.Formatter._constructors[valueType] is not a constructor```. > > (Note: there's now a test case using the Italian football data that can be > seen at oacurriculumcollection.org/exhibit-test, in addition to the page at > oacurriculumcollection.org/oacc-exhibit) > > I've tried my csv data from a gsheet, and I used the gsheet data from the > sample site that Luis has mentioned > http://lmorillas.github.io/exhibit_tests/testcsv/. In both cases it's clear > that the data is retrieved successfully, the database if created, and, so far > as I can tell, the data in it is complete and correct. But when exhibit tries > to deploy it on the page, I get the same `TypeError`. > > The old jsonp method, using data-ex-converter="googleSpreadsheets" worked > fine in the context of my php page, but there's something about the retrieved > csv data in this context that continues to throw this error. > > The full traceback for this error is the same in every instance. It is > appended below. > > I was Curious to know what `valueType` it is for which there is no > constructor. I wish I were more adept with the browser's debugger (such tools > always present me with more confusion than clarity), so I put a console.log() > call into ".../exhibit/scripts/ui/lens.js" at line 1007 in the > `Exhibit.Lens._constructDefaultValueList` function (the 5th item in the > traceback included below). The result was that for any given record in the > spreadsheet, two `valueType`s were reported: "item", and "single". That was > interesting, but I'm really none the wiser. The list of > `Exhibit.Formatter._constructor`s does include "item", it does not include > "single", but I don't know how these values are being derived from the csv > data, or how they are supposed to be deployed in the UI. > > Something there is that doesn't love a csv input in my particular context, > and I'm damned if I know what. > > If you've any further thoughts at all about this, I'd love to know. > > best, > Jon > *** > browser console traceback for the TypeError: > ``` > debug.js:90:25 > TypeError: Exhibit.Formatter._constructors[valueType] is not a constructor > format > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/ui/ui-context.js:202 > formatList > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/ui/formatter.js:110 > visit > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/util/set.js:156 > formatList > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/ui/formatter.js:109 > formatList > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/ui/ui-context.js:217 > _constructDefaultValueList > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/ui/lens.js:1007 > f > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/util/debug.js:90 > exception > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/util/debug.js:103 > _createView > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/ui/views/view-panel.js:377 > _initializeUI > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/ui/views/view-panel.js:347 > createFromDOM > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/ui/views/view-panel.js:188 > createFromDOM > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/ui/ui.js:120 > processElmts > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/exhibit.js:453 > configureFromDOM > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/exhibit.js:476 > fDone > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/exhibit.js:42 > jQuery 9 > fNext > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:799 > finish > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importer.js:129 > loadData > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:116 > postParse > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importer.js:150 > parse > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importers/json.js:30 > postLoad > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importer.js:162 > jQuery 6 > _loadURL > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importer.js:218 > load > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importer.js:171 > fNext > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:792 > finish > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importer.js:129 > wrapFinish > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:298 > (Async: setTimeout handler) > chunker > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:278 > (Async: setTimeout handler) > chunker > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:275 > _loadChunked > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:281 > loadItems > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:316 > loadData > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:114 > postParse > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importer.js:150 > parse > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importers/tsv-csv.js:54 > postLoad > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importer.js:162 > jQuery 6 > _loadURL > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importer.js:218 > load > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/importer.js:171 > fNext > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:792 > _loadLinks > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:801 > loadLinks > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/data/database/local.js:91 > autoCreate > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/exhibit.js:73 > <anonymous> > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/final.js:57 > jQuery 9 > <anonymous> > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/final.js:52 > jQuery 9 > <anonymous> > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/final.js:46 > jQuery 9 > importLocale > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/scripts/util/localization.js:214 > <anonymous> > http://oacurriculumcollection.org/wp-content/themes/education-zone-child/js/exhibit-dist/locales/en/locale.js:1 > ``` > > > On Sunday, September 12, 2021 at 10:12:34 PM UTC-7 Luis Miguel Morillas wrote: >> >> Added multiple-values parsing to >> https://lmorillas.github.io/exhibit_tests/testoacurriculum/ >> >> Saludos, >> >> -- luismiguel (@lmorillas) >> >> El lun, 13 sept 2021 a las 7:08, Luis Miguel Morillas >> (<[email protected]>) escribió: >> > >> > El dom, 12 sept 2021 a las 22:05, jjon (<[email protected]>) escribió: >> > > >> > > Thanks Luis, >> > > It's helpful to see that a simplified version of the page can be built >> > > from the data retrieved via csv; however, I'd like to track down what >> > > about the csv data is causing the TypeError: `TypeError: >> > > Exhibit.Formatter._constructors[valueType]`. >> > >> > OK. I see. The simplied version removed all external js because maybe >> > there is some kind race condition conflict in your code. >> > >> > > For this wordpress page, I've been using a locally sourced copy of the >> > > Exhibit code base, this copy is the same one as at >> > > http://api.simile-widgets.org/exhibit/current/exhibit-api.js >> > > (3.1.2-rc3). Before the jsonp method stopped working, this version was >> > > understanding my unfortunate Exhibit2 syntax just fine. Just in case, I >> > > went in and updated all the ver2 tag attribute syntax, but that didn't >> > > solve the problem. >> > > >> > > The fact that your simplified and updated page also does not correctly >> > > interpret the semi-colons in cells as multiple values is also >> > > suggestive. Of what, I don't know yet. I need to understand the code >> > > base better I guess. I'm pretty far out on the edge of my understanding. >> > > Something about the csv data, vs the json data, throws the TypeError. I >> > > need to understand why the Exhibit.Formatter constructors don't >> > > recognize the `valueType` they're being given. Then I can change the >> > > spreadsheet accordingly, or compensate for it in the exhibit html, or >> > > maybe do some kind of js preprocessing of the incoming csv. >> > >> > You can use data-ex-value-separator=";" for multiple values. >> > >> > > >> > > Still puzzled, >> > Tell me if I can help >> > >> > Best, >> > >> > -- @lmorillas >> > > Jon >> > > >> > > On Saturday, September 11, 2021 at 10:56:59 AM UTC-7 Luis Miguel >> > > Morillas wrote: >> > >> >> > >> I've simplified your page. I don't know if it's you need. The example >> > >> uses your spreadsheet and a simplified version of your html page >> > >> translated to exhibit 3 syntax [1] >> > >> >> > >> [1] http://lmorillas.github.io/exhibit_tests/testoacurriculum/ >> > >> >> > >> >> > >> Saludos, >> > >> >> > >> -- luismiguel (@lmorillas) >> > >> >> > >> El jue, 9 sept 2021 a las 1:00, jjon (<[email protected]>) escribió: >> > >> > >> > >> > Luis, Daniel, David, et al. >> > >> > I have an exhibit page that worked fine for a long time using jsonp >> > >> > to retrieve data from a public google spreadsheet. The php generated >> > >> > a <link/> in the head like this: >> > >> > ```<link rel="exhibit/data" >> > >> > type="application/jsonp" >> > >> > href="https://spreadsheets.google.com/feeds/list/1QFApf8MGr-ZP-OqvKtPFUEASuaq9_vuvLOfanC4NGHQ/od6/public/basic?alt=json-in-script" >> > >> > ex:converter="googleSpreadsheets" />``` >> > >> > That doesn't work any more. >> > >> > Following your discussion, I tried to find a way to fetch and parse >> > >> > the data as csv. >> > >> > Like Daniel I thought Ben Borgers solution might take too much >> > >> > fiddleing (just hacking off the function call seems, well, hacky). >> > >> > Luis's example doesn't seem to work either. >> > >> > I finally figured out a url that would return the spreadsheet data as >> > >> > csv. This is what the <link/> element now looks like: >> > >> > ```<link >> > >> > href="https://docs.google.com/spreadsheets/d/1QFApf8MGr-ZP-OqvKtPFUEASuaq9_vuvLOfanC4NGHQ/export?format=csv" >> > >> > type="text/csv" >> > >> > rel="exhibit/data" >> > >> > data-ex-properties="label,itemID,Link1,Link2,Link3,Short_Description:single,Long_Description:single,Developer,Category,Activity_Type,imageURL,Tags,Grade_Band,OA_Principle" >> > >> > data-ex-has-column-titles="true" >> > >> > /> >> > >> > This successfully retrieves csv from the spreadsheet, but Exhibit >> > >> > does not seem to parse it correctly. >> > >> > On load, in the console I get, among other things: >> > >> > a warning: Item entry has no label and no id: {} debug.js:57:21 >> > >> > a report: Failed to create view Summary (0) debug.js:35:21 >> > >> > and an error: TypeError: Exhibit.Formatter._constructors[valueType] >> > >> > is not a constructor. ...debug.js:90:25 >> > >> > >> > >> > any clues as to how I might repair this would be welcome. >> > >> > best >> > >> > Jon >> > >> > >> > >> > On Saturday, August 21, 2021 at 9:21:11 AM UTC-7 Luis Miguel Morillas >> > >> > wrote: >> > >> >> >> > >> >> Hola, Daniel, >> > >> >> >> > >> >> Well, the first approach, as Ben says, works fine now, but it returns >> > >> >> a json that you must arrange to work with exhibit[1] if you use this >> > >> >> spreadsheet for example [2] with this url [3] as Ben suggests. >> > >> >> >> > >> >> I think it's easier to use csv from google spreadsheets directly. Or >> > >> >> you can get the csv and convert internally to json, but exhibit can >> > >> >> read right the csv. >> > >> >> >> > >> >> [1] >> > >> >> https://gist.github.com/lmorillas/cbf2a0fb4a28ba7d016568ac9269bd37 >> > >> >> [2] >> > >> >> https://docs.google.com/spreadsheets/d/1v-b_AaChE431LvPLlGFSykJFoD--OKRBOjqgiZ7hqPA/edit#gid=180101019 >> > >> >> [3] >> > >> >> https://docs.google.com/spreadsheets/d/1v-b_AaChE431LvPLlGFSykJFoD--OKRBOjqgiZ7hqPA/gviz/tq?tqx=out:json >> > >> >> >> > >> >> Saludos, >> > >> >> >> > >> >> -- luismiguel (@lmorillas) >> > >> >> >> > >> >> >> > >> >> El vie, 20 ago 2021 a las 21:46, dhinostroza (<[email protected]>) >> > >> >> escribió: >> > >> >> > >> > >> >> > Hi Luis Miguel and David, >> > >> >> > I tested Ben Borgers solution first and it didn't work on the >> > >> >> > first go. Maybe it's just a matter of tweaking it a bit further to >> > >> >> > get the settings right... >> > >> >> > So, I then tested Luis Miguel's solution (publishing the Google >> > >> >> > spreadsheet to csv and replacing the json link with the full >> > >> >> > published as csv link in my SIMILE page) and it worked perfectly. >> > >> >> > It looks like this (I made up the column titles for this example): >> > >> >> > <link >> > >> >> > href="https://docs.google.com/spreadsheets/d/e/2PACX-1vSq-fac7XtI1IXXXXXXxxXXXXXxxXXXXXXxXXXXNXXXXXXXXXXXX_XXXXXXXXX_XXXXXXXXXXXXXXXX/pub?gid=1300000000&single=true&output=csv" >> > >> >> > type="text/csv" rel="exhibit/data" >> > >> >> > data-ex-properties="label,ID,Lname,Fname,Email,Observations" >> > >> >> > data-ex-has-column-titles="true"/> >> > >> >> > I'm using the full path to exhibit-api >> > >> >> > (http://api.simile-widgets.org/exhibit/3.1.2rc2/exhibit-api.js) >> > >> >> > url but the shortened >> > >> >> > (//api.simile-widgets.org/exhibit/current/exhibit-api.js) has also >> > >> >> > worked for me in other projects. >> > >> >> > Thank you! >> > >> >> > Daniel >> > >> >> > >> > >> >> > On Friday, August 20, 2021 at 2:01:37 AM UTC-5 Luis Miguel >> > >> >> > Morillas wrote: >> > >> >> >> >> > >> >> >> David, I think that it is the old method that has been removed >> > >> >> >> now. >> > >> >> >> >> > >> >> >> Saludos, >> > >> >> >> >> > >> >> >> -- luismiguel (@lmorillas) >> > >> >> >> >> > >> >> >> El vie, 20 ago 2021 a las 4:08, David Karger (<[email protected]>) >> > >> >> >> escribió: >> > >> >> >> > >> > >> >> >> > According to this article: >> > >> >> >> > >> > >> >> >> > https://benborgers.com/posts/google-sheets-json >> > >> >> >> > >> > >> >> >> > the following should work: >> > >> >> >> > >> > >> >> >> > https://spreadsheets.google.com/feeds/list/spreadsheet_key/1/public/values?alt=json >> > >> >> >> > >> > >> >> >> > that is, replace /od6/public/basic?alt=json-in-script at the >> > >> >> >> > end with >> > >> >> >> > /1/public/values?alt=json >> > >> >> >> > >> > >> >> >> > >> > >> >> >> > On 8/18/2021 11:08 AM, Luis Miguel Morillas wrote: >> > >> >> >> > > I'm afraid the Data API is down [1]. Look at >> > >> >> >> > > https://docs.google.com/feeds/list/1H38J-cLEAt8VhDuhMvJgSGH4KzT0LrhFl9tvGTQpqWI/1/public/values?alt=json-in-script >> > >> >> >> > > You can use csv export either. >> > >> >> >> > > >> > >> >> >> > > [1] https://developers.google.com/gdata/docs/json >> > >> >> >> > > >> > >> >> >> > > Saludos, >> > >> >> >> > > >> > >> >> >> > > -- luismiguel (@lmorillas) >> > >> >> >> > > >> > >> >> >> > > El mié, 18 ago 2021 a las 15:13, Andrea Borruso >> > >> >> >> > > (<[email protected]>) escribió: >> > >> >> >> > >> Hi, >> > >> >> >> > >> I used for some simile pages this kind of URL: >> > >> >> >> > >> >> > >> >> >> > >> https://spreadsheets.google.com/feeds/list/1H38J-cLEAt8VhDuhMvJgSGH4KzT0LrhFl9tvGTQpqWI/od6/public/basic?alt=json-in-script >> > >> >> >> > >> >> > >> >> >> > >> But none of these URLs work anymore. >> > >> >> >> > >> >> > >> >> >> > >> What's the new URL schema for this kind of output? >> > >> >> >> > >> >> > >> >> >> > >> Thank you >> > >> >> >> > >> >> > >> >> >> > >> -- >> > >> >> >> > >> You received this message because you are subscribed to the >> > >> >> >> > >> Google Groups "SIMILE Widgets" group. >> > >> >> >> > >> To unsubscribe from this group and stop receiving emails >> > >> >> >> > >> from it, send an email to [email protected]. >> > >> >> >> > >> To view this discussion on the web visit >> > >> >> >> > >> https://groups.google.com/d/msgid/simile-widgets/8b661bc0-6887-4491-8349-34fb0f290a25n%40googlegroups.com. >> > >> >> >> > >> > >> >> >> > -- >> > >> >> >> > You received this message because you are subscribed to the >> > >> >> >> > Google Groups "SIMILE Widgets" group. >> > >> >> >> > To unsubscribe from this group and stop receiving emails from >> > >> >> >> > it, send an email to [email protected]. >> > >> >> >> > To view this discussion on the web visit >> > >> >> >> > https://groups.google.com/d/msgid/simile-widgets/43e5cf7b-783f-68fb-129f-e93e33f7ddfa%40mit.edu. >> > >> >> > >> > >> >> > -- >> > >> >> > You received this message because you are subscribed to the Google >> > >> >> > Groups "SIMILE Widgets" group. >> > >> >> > To unsubscribe from this group and stop receiving emails from it, >> > >> >> > send an email to [email protected]. >> > >> >> > To view this discussion on the web visit >> > >> >> > https://groups.google.com/d/msgid/simile-widgets/0caa446b-b900-49f6-8138-feacb2531057n%40googlegroups.com. >> > >> > >> > >> > -- >> > >> > You received this message because you are subscribed to the Google >> > >> > Groups "SIMILE Widgets" group. >> > >> > To unsubscribe from this group and stop receiving emails from it, >> > >> > send an email to [email protected]. >> > >> > To view this discussion on the web visit >> > >> > https://groups.google.com/d/msgid/simile-widgets/21b011f7-c59b-4ee5-9107-c15d8e681a36n%40googlegroups.com. >> > > >> > > -- >> > > You received this message because you are subscribed to the Google >> > > Groups "SIMILE Widgets" group. >> > > To unsubscribe from this group and stop receiving emails from it, send >> > > an email to [email protected]. >> > > To view this discussion on the web visit >> > > https://groups.google.com/d/msgid/simile-widgets/694d72dd-d15b-46dd-9255-8b7222b8da44n%40googlegroups.com. > > -- > You received this message because you are subscribed to the Google Groups > "SIMILE Widgets" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/simile-widgets/5deb6891-cad9-4c35-89a8-210a0093d787n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/simile-widgets/CAFQDTO1DA1igz8P1Xy%2Bx26OjTnZM3L7_2grhJZS%2BmnBqxFDa5Q%40mail.gmail.com.
