Detect list selection
In a table view/list, select a row and the form slides out. One can move the selection up and down the list and the form data changes to reflect the selected row. Standard Ninox behaviour.
Is there any way to detect when a (different) row is selected? Basically a trigger when the row selection changes?
42 replies
-
This post might help you:
https://forum.ninox.com/t/60hbvbz/add-onselect-event-for-view-field -
I will get back to this shortly, but could I ask a couple of questions here (asked on Github, but it seems you are not reading those 'issues':-
Does the code to load these have to be run for every session or only once and then it's downloaded and hence persistent between sessions?
What is meant by 'file' and 'comment' in badges.html:? To what are you referring since Ninox is a database and as such, one is not working with either?
In the Ninox editor, I already see a list of possible 'completions'. What does completion.html do that Ninox is not already doing? Are they mutually incompatible?
-
Ok, I can see what it's doing, but could that initialisation code be placed actually in 'Trigger after open'? Surely is just needs to run and doesn't matter where, just as long as it does run on opening the database?
I tried:-
var configLoadModules := { completion: false, badges: true, evalJS: true, viewEvent: true }; html(http("GET", "https://raw.githubusercontent.com/JacquesTur/Ninext/main/loadModules.html").result);
in the console as I can also see no reason for that to not work, but the displayed result was just the unformatted text of loadModules.html.
Is there a reason why the above only works when run in some places, but not others?
-
The above, placed in a formula field does load the extended functions, but not in either the Console, nor in 'Trigger after open' and I cannot really figure out why.
Is there any way to make it run in 'Trigger after open' as that's the ideal place for it, designed specifically for code to run once, only when the database is first opened.
-
Now I am completely confused. I ran the code to load the modules in a formula field, saw the expected result and then clicking on any row in the table's main view, the onSelected function was working correctly.
I then set up the Initialisation table with a formula field to load the modules and that provides the same correct result as expected. However when I then try the table row selection that was working (once modules loaded), it doesn't work.
As a test I have another formula field doing the JavaScript calculation from your example and I can see the result is 30. So the modules are loaded, but onSelected is not working.
I've put an 'alert' into the function, but it never shows. I moved it outside the function and it is displayed once when first going to that table, but not again when just selecting rows. So either it is not always showing alerts every time it runs that 'Readable if…' code, or that code is not often run. In either case the function doesn't seem to run.
All of which has me confused since it was working before I set up the initialisation stuff.
Any suggestions? Did you change the module code?
-
I set up a very simple test, exactly as you did in the example above. In 'Readable if' I have:-
function onselected() do this.(testbool := true) end; true
testbool is as it seems, a simple boolean (yes/no) for testing. I can click on any row in the table and that field is not updated (from default null).
As far as I can determine, that onselected() function is simply not running. But it did yesterday.
????
-
The only difference I can think of is that yesterday I ran the load module code in a formula field on that same form (next to the test JS calculation), whereas now it is being run in the initialisation table. But either way, the JS calculation runs correctly.
Content aside
- 2 yrs agoLast active
- 42Replies
- 678Views
-
3
Following