Closed ElnazTaqizadeh closed 5 years ago
@ElnazTaqizadeh if it is a builtin Eureka SegmentedRow<T>
you can set it's value by getting the row as:
let rw = form.rowBy(tag: spltKey) as? SegmentedRow<String>
row.value = "test"
Please note that as? SegmentedRow<....>
has to match the type you are actually use for the SegmentedRows value.
Thanks, @marbetschar. I've got this point before, but I thought there's something wrong that neither of segments has been selected automatically. I've tried:
row.cellUpate()
and
row.reload()
However, none of them worked. When we call the tableview.reloadData()
there's no problem with segment selection. I don't know if I miss any function here?
Edited:
I've tried
tableView.reloadRows(at: [indexPath], with: .automatic)
too. That's weird, these reloading methods work perfectly for one of the options but not the other one.
It seems using the following lines together solve the problem!
row?.updateCell()
tableView.reloadData()
@ElnazTaqizadeh glad you were able to solve the issue! Even though calling tableView.reloadData()
seems a bit dramatic. You may try to ensure setting the row's value in the main queue - maybe this is already enough (also had issues with this in the past, if the value was not set in main queue):
DispatchQueue.main.async {
row?.value = "my new value"
}
If that's not enough try:
DispatchQueue.main.async {
row?.value = "my new value"
row?.updateCell()
}
In any case, glad it works!
In an attempt of creating a segmentedRow, I've got:
'SplitRow' requires that 'SegmentedRow' inherit from 'BaseRow.'
so I turned it back as a simple base row of Eureka.
Now for filling the form with stored values, I follow the method which has been covered in other issues:
However, I cannot set the SegmentedRow value like this. Is there any way to set the value for specific BaseRow (instead of the whole form by form.setValues(storedValue) ) or make this row as a splitRow and follow the same approach for setting values?