Building a basic Sync() Function?

While I’m fond of widget.newTableView…it’s broken, so I’m busy turning ListView’s [lua]newList()[/lua] into something comparable. …However, there’s one really important feature the widget has that ListView lacks.

Syncing the table.

With the widget, you can state:

myList:sync(data) and your list will magically refresh with whatever new order/look you’ve come up with.

Ergo, this is my stab in the dark:

  1. Add a function inside the newList() function called sync().
  2. Use table.remove to empty out the entire table data{}.
  3. Build the entire table again using the existing params (while local, I’m still inside the function at this point.)

What’s not clear is:
a. Is there some way simpler solution I’m not seeing?
b. If this is the route to take, does calling a function inside that very function work? Seems a little dubious from a code point of view.

Cheers! [import]uid: 41884 topic_id: 14247 reply_id: 314247[/import]