Making a DGrid "refresh"

What would be an efficient refreshing items on a DGrid?

I’m currently attempting to make something where once you purchase an item, the item has to be wiped from the DGrid and added to a different DGrid. The issue is that currently the net message and the function are not connected in anyway, and the DGrid is a local item in the function.

What would be a good way, clean way of accomplishing this?


Make a global variable though which you can call a custom method on your menu to rebuild the inventories, call that from your net message. ( After receiving the new data )

Alright, I did that, thanks.

When I attempt to clear the grid, I get this error:

[ERROR] lua/vgui/dgrid.lua:96: Tried to use invalid object (type Panel) (Object was NULL or not of the right type)
  1. SetPos - [C]:-1
   2. unknown - lua/vgui/dgrid.lua:96

Here is the code im using to clear the grid:


It clears the grid, but when I attempt to re-add stuff to the grid, it errors out.

You are probably trying to add the removed panels back, create new ones.