That's correct - and while using Observables for the model, when I key in the text field, you see the value, but immediately the entire table refreshes.
Post
Replies
Boosts
Views
Activity
Did not work .... the data table, is creating a dynamic field, based on the contents it is loading:
@ViewBuilder
func createKeyField(row :DataFrame.Rows.Element, columnName :String) -> some View
{
let binding = Binding(
get: { dbModel.getColumnValue(row :row, columnName :columnName) },
set:
{
dbModel.setColumnValue(row :row, columnName :columnName, value :$0)
}
)
TextField("", text: binding)
}
func setColumnValue(row :DataFrame.Rows.Element, columnName :String, value :String)
{
data[columnName][row.id] = value
}
but the value does not get changed
Thanks Eskimo for this ... I will apply the changes as you outlined !
I was able to load a CSV into a TabularData based SwiftUI app -- loading and displaying was no issue ... but, HOW to update a value in a column.
I created a bindable textfield for the columns in the table, and it displays the value for the rows/columns, and while the code to update the column compiles, it never updates the value in the DataFrame.
Is a DataFrame read only ?
Having done this ... how can you update a column in a DataFrame ?
https://linkmaker.itunes.apple.com/en-us/language