I am trying to add data in table component through text field component in perspective. Is there any way to update data through user input in text field?
I would add a value change script on the textField that appends to the data property on the table with a new row. The other option is to have a button next to the textField that appends whatever is in the textField to the table.
You might want to think through what you are trying to achieve.
- When does the text get added? (What user action triggers the addition of the data to the table and the clearing of the text field? Or do you want the text field to have all text selected so it can be edited for the next row?)
- What is going to happen to the data when the view is closed? i.e., If you want to store the data in a database then you need to save it to the database and then have the table update by a database query binding.
Think it through. Then edit your question.
These are the following steps I am trying to do:
The user inserts data into the textfield component and clicks the add button. The textfield will be cleared then. The data will be stored on the dataset memory tag which is binded with a table component.
When all the data is inserted, the user will finally click on the submit button that will send all the data to a database (to save it).
The dataset memory data will be cleared to add more data. The database will be updated for new incoming data.
Now what I would like to ask is that instead of textfield component I need to insert data in the table cell which will populate the dataset memory tag. How it would be possible?
- It would be more sensible to edit in the table cell directly. You would need a + add row button and some code to add a row to the table data. The Enter key would trigger an onEditCellCommit event and you write the code in there to update the table data.
- You would need to add a script to a button onClick event. That would then need to loop through all the rows in the table and run an SQL INSERT.
- The onClick code would also clear the table.