List View (nor Detail View) not working

I try to generate the list (and detail) view in a new app I’ve developped only for test (named “titular”).
I’ve follow step by step the instructions here:
https://docs.odk-x.org/build-app/#odk-x-tables-designing-a-custom-view
I’ve created the directory structure by using grunt addtableid:titular
I’ve completed the directory structure, and I’ve generated the titular.xlsx and framework.xlsx files, and placed in the expected folders.
I’ve add the “properties” sheet with the columns and rows as indicated by the refered instructions.
After push the content to my device, I can see the form using Survey, and I can generate instances with no problem. The problem arise when I use Tables: I can access the form, and the list view is well stablished as the default view, but it’s empty; I can select the sheet view, and I can see the instances saved, but If I select the list view, it 's empty (I don’t see anything), and the detail view is no available.

I think the problem arise from the titular_list.html file, automatically generated by grunt: its content is not like expected:

  • in the head tag, the row for meta does not exist (perhaps a minor question)
  • also in the head tag, I don’t see the script tag rows for commonDefinitions.js, tableSpecificDefinitions.js, odkcommon.js, odkdata.js nor odkTables.js; nevertheless, I see other script tag rows that I don’t expect, and probably are causing the problems (I leave the “<” and “<” simbols at the beginning and at the end, to let the rows be showed):
    script type=“text/javascript” src="…/…/…/framework/tables/js/control.js"></script
    script type=“text/javascript” src="…/…/…/framework/tables/js/data.js"></script

First at all, the folder “…/…/…/framework/tables/js/” does not exist … I think the framework folder are inside the assets folder, so the address are not correctly defined.
Second, the files control.js and data.js does not exist, and they are not referenced in all the docs file… or at least, I’ve not find anything from its.

Thanks in advance!!
@aortegon

1 Like

As you correctly noticed, control.js and data.js are outdated files. The attached titular.zip (15.4 KB) file has examples of a list and detail view using updated functionality. In the zip file, the titular_list.html and titular_detail.html files in the html folder are the best place to start. Let us know if you have additional questions.

3 Likes

Thank you very match @clarice_larson larice_larson!!
It’s sound very well: when I look the files you send me, it seems they will work… but, unfortunately, until the moment, I don’t reach to see the list view, and the detail view continous to be unavailabe, as you can see in the image!! Grrrr

Opening the “titular_list.html” file in a Chrome browser, and accessing the console, I can see that object “okdData” is undefined… what I don’t understand ???

I don’t know if it’s related with others errors showed at the console, indicating that the file “titular_data.json” doesn’t exist.

I profit to ask you, if I don’t bother you, some questions related with your answer:

  • The files “titular_list.js” and “titular_detail.js”, and its related html files, aren’t well generated. There’s something I have not well doing, or perhaps we need to update the grunt task used to generate its (grunt addtableid:titular).
  • About the “titular_data.json” file not present in the …app/output/debug/ folder, it’s automatically generated, or I must generate it?. I’ve not find some note about this in all the documentation.
  • About the “titular.xlsx” file you send, looking at the “properties” sheet, I see the last 2 rows (I’ve have pasted its in my “titular.xlsx” file, and I’ve converted using XLSXConverter, fine!!). I don’t see any reference to that in all the documentation… Am I a little lost??

Thanks, thanks a lot!!
I apologize for the inconvenients!!

No worries.

The files in the zip file will work with versions 2.1.6 and higher. What version of ODK-X are you using? It is best to use the latest version if possible.

To answer your questions:

  • The generated titular_list.js and titular_detail.js are out of date if you are using version 2.1.6. The grunt addtable task does need to be updated. I’ve created an issue to track this.

  • The “titular_data.json” file is no longer needed in version 2.1.6 or later. You should not need to generate this.

  • The last two lines of the properties worksheet set the formId for ODK-X Survey.

I wanted to clarify that to get a list and detail view to work in ODK-X Tables, users will need to write some custom JavaScript. In the titular_list.js file on line 78, you will need to change:

item.text(titularResultSet.getData(i, ‘test’));

from using ‘test’ to the name of the prompt you want to display from your titular.xlsx survey worksheet.

Also, in titular_detail.js on line 10, you will need to change:

$(’#test’).text(result.get(‘test’));

to use the fields that you want. The HTML in titular_list.html and titular_detail.html can be customized to display the data that you want as well.

2 Likes

Thanks @clarice_larson!! Now it works!!
I see that the behavior is exactly the same at Chrome: I obtain the same error.
In my device the problem is jet solved, and I think I have understand, thanks a lot!!

I’m using versions 2.1.7.
I’ll follow your issue, thanks!
Ok with the json file also.
Ok with the last two lines of properties worksheet. I think the documentation need to be updated to explain this… isnt’it?

For the last, know you what’s the correct manner to syncronize my device after pushing files by means of grunt adbpush? I ask because after pushing, I want to try with only the files I just put in my device, but if I syncronize, I must wait for all the files in the server… There is some manner to avoid that?

Thanks!!

1 Like

You can reset the sync-endpoint to match your mobile device by logging in with a user with appropriate permissions and using the “Reset App Server” button. This will cause the server to reset itself and synchronize the mobile device to the server instead of the “normal” synchronizing the server to the mobile device.

https://docs.odk-x.org/services-managing/#resetting-the-app-server

3 Likes

As @W_Brunette mentioned resetting the app server is the right thing to do. This will push the configuration and content on your phone up to your server and only needs to be done once. After the server and device configuration match, other users will be able to sync the configuration and data to their phones using the server. At this point, any user syncing to the server will get the latest synced data.

2 Likes

Ok!
So, even if I want to test some forms, and see its appearance with Survey and Tables, I need to have a Sync-Endpoint.

Thanks a lot another time!!

@aortegon you can test with Survey and Tables on a single device attached to your computer using a usb cable and ‘grunt adbpush’.

Sync-Endpoint is used to synchronize between mobile devices (more than one device).

You may have run into an issue where Services, Survey, or Tables needs to read again the configuration from the persistent storage. At the end of the sync protocol the ODK-X automatically reloads the configuration because a change may have happend.

If you are manually adding things you want to manually activate reload of configuration. In Services, the setting list has a “Reset Configuration Option” in the list.

https://docs.odk-x.org/services-managing/#resetting-configuration

2 Likes

Ok!!! That’s fine, very fine!!!
This is what I need to know, to understand!!

Perhaps, it will be desirable that the documentation would have a note indicating the need to Reset Configuration after pushing files to the device, in the “Pushing and Pulling Files” point, in the form of a “Note”, or a “Tip”… it’s only a suggestion.

Thanks a lot @W_Brunette, and thanks a lot also at @clarice_larson who have very well helped to me!!

1 Like