I have a table as a component, and now I am trying to build a column wise search within it.The table that will be created will have a dynamic number of columns. Hence I need to create multiple variables for binding with the search input. I was trying to create those variables with eval (unsuccessfully, because I cannot use eval with svelte functionalities like writable or $:).
Note: the main restrictions I have are,
- the the dynamic variable has to be declared as writable('')
- create columns has to be in a function (as I have to recreate them for other conditions), but the search columns needs to be outside the function, as it will be used across the page
- the number of total columns and the number of searchable columns are dynamic
- the full functionality is much more huge and complex, hence shared a small part of it, where I need some support
Note: Doing first time front end development, coming from Mainframes backend dev.
I have tried to replicate my scenario in the below repl (not working.. but you will get gist):https://svelte.dev/repl/42335b2b121a402da1c5cd6c826bb5df?version=4.2.19
Expectation:Need the value from any of those inputs to $searchColumn and the corresponding column value. Based on this I will use it to perform next set of tasks. Please see a working version of the scenario but with static defined variables:https://svelte.dev/repl/fa3bd4c83d53421ea0eb3ae5936b401c?version=4.2.19