Replies: 1 comment
-
The answer is that while lexical scope gives us this quick and dirty functionality, for more dynamic capabilities we have to use a different approach with different data structures. Closing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am creating a view to display a list of documents in a table that looks like this:
The code that generates the view is this:
The let in the loop creates the lexical scope around the variables for the row and column values so that we can act on those as necessary. In the screenshot I have just a DELETE in ACTION column and it hides the row that it is in if the check box is checked.
What I want to do is be able to check all of the check boxes and select a DELETE button at the top of the table and then act on all of the rows in some way, for example, DELETE as that button would imply. This is a fairly common metaphor in displaying data in lists.
Now, the simplest way to check all boxes is to just use a javascript function in a (set-on-click ...) event, that is no problem. What i am not able to visualize is how to act on all of the checked rows. Outside of the (let* ...) in the loop we cannot reach into the lexical scope of each row and peform actions, and I am not able to see how to act on each of the rows that are checked within that (let* ...).
The only way that I can see to accomplish this would be to create a variable + hashtable in the let, have the loop store data in the hashtable and then iterate over that when the DELETE button is clicked. That doesn't seem that elegant to me, any other suggestions on how to approach this problem?
Beta Was this translation helpful? Give feedback.
All reactions