Model¶
- class Model.Updater(get_uuid)¶
- Arguments
get_uuid (
function()
) – Function to call to get an item’s UUID.
This objects allows update of a
ListModel
without resetting the whole model if only some items change..import fbx.data 1.0 as Data var dmu = new Data.Model.Updater(function (item) { return item.id; });
- Model.Updater.Model.Updater.update(elements, model, compare_sort_fn, direct)¶
- Arguments
elements (
list()
) – A list of itemsmodel (
ListModel()
) – A reference to a list model to update tocompare_sort_fn (
function()
) – A function to call to compare position of two itemsdirect (
bool()
) – Whether update is direct or should usemodel.sync()
.
After this function is called, model will contain all items from
elements
, ordered bycompare_sort_fn
. Items that existed in model already will just get updated / moved.