Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the value of a XLFORM row

Tags:

swift

xlform

I am using the XLFORM library with swift, I want to clear the value of the row after a successfully request .

I am trying to get the row object using self.form.formRowWithTag and changing the value using .value but unfortunately I am not able to get the row's object :(

anyone can help on this ?

like image 590
yjradeh Avatar asked May 24 '15 14:05

yjradeh


2 Answers

I was searching for this answer as well, and your answer gave me inspiration.

What you have done so far is correct. Here is the code:

self.form.formRowWithTag("whatever-tag").value = nil
self.tableView.reloadData()

The key is to reload your UITableView

Hope this helps =)

like image 68
SilverHood Avatar answered Nov 18 '22 15:11

SilverHood


While the above answer might work, I found out how to do it the way XLForm author wants you to do. On XLForm Github, the author says:

You may have to update the cell to see the UI changes if the row is already presented. -(void)reloadFormRow:(XLFormRowDescriptor *)formRow method is provided by XLFormViewController to do so.

So, you can do this:

var row = self.form.formRowWithTag("whatever-tag")
row.value = nil
self.reloadFormRow(row)

Hope this helps.

like image 44
nekonari Avatar answered Nov 18 '22 15:11

nekonari