My WebViewer app is fetching data from www-server database.
The data can be sorted in WebViewer by columns.
But after sorting, the data content does not get sorted however, it remains on the original row/record.
E.g. if we take a look at the data record which belongs to ID 4 (on row #4).
If we sort the WebViewer data according to STATUS, the ID 4 record moves to the row #2.
But the record content (which should be seen by clicking on the correspondent row), remains on the original row #4.
So as a result of sorting, rows 2 and 4 changed places in WebViewer but their contents did not.
How to get the contents inlcuded with sorting?
Should I reload the content from my www -database using either "when WebViewer.PageLoaded" or "when WebViewer.WebViewStringChange" functions?
(note:sorting is handled in the table_color_button_filter_reverse_v3.html)
I will have to have a closer look....all I can suggest at the moment is that when selecting a row, you are returning data from the original table, not the sorted one. Need to work through the code to figure it out though....
In your javascript, you are returning ONLY the index of the row to the webviewstring.
In your app, the list/table data has NOT been sorted, therefore the index will return the data from the original position of the index.
If you use:
var picked = this.innerHTML.replace(/<td>/g, "").replace(/<\/td>/g, delimiter).replace(/(\s+)?.$/, '');
window.AppInventor.setWebViewString(picked);
I also find, with the code that is there, on the first click to sort a column, it just reverses it (no sorting), on a second click you then get the sort. Is this what you want ?
Secondly, you are right about that the 1st click only reverses the rows and only after the 2nd click it sorts. A bit annoying and not exactly what I want but I can live with that. I tried to find out where in the html code this happens but I am not sure. If you can point if out to me it would be great
This was already there in the original table script code from Taifun. What it does is grab the row that has been clicked, then removes all the html formatting and tags in order to return the base data.