Tableview categories on the fly

Hello


I'm trying to figure out how to add categories in runtime at your Tableview component, this is because I need to fill the categories based on a different results.

---------------------------------
Productos.Categories.Clear;

For X := Low(ResultadoProductos) to High(ResultadoProductos) do
If Productos.Categories.ItemIndexById(ResultadoProductos.Unidad) = -1 then
Begin
Productos.Categories.Add.Id := ResultadoProductos.Unidad;
Productos.Categories.ItemById(ResultadoProductos.Unidad).Caption := ResultadoProductos.UnidadMedida;                         
End; 
-------------------------------


Once the categories are complete with all possible values, then I get all details and assigned each record to specific category


DetalleCFDI.CategoryID := ResultadoProductos.Unidad;



However this is not working, apparently your tableview only works with the categories fill in design time why?

did you use BeginUpdate and EndUpdate wrappers around the code?

Indeed