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[X].Unidad) = -1 then
Begin
Productos.Categories.Add.Id := ResultadoProductos[X].Unidad;
Productos.Categories.ItemById(ResultadoProductos[X].Unidad).Caption := ResultadoProductos[X].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[X].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