docstr: Update the grid after the table data has changed
docstr_tok: ["Update","the","grid","after","the","table","data","has","changed"]
code: def update_grid(self):
      """Update the grid after the table data has changed"""
      need_column_layout = False
      grid = self.grid
      v = self.v
      if len(v.column_names) < grid.GetNumberCols():
          tm = wx.grid.GridTableMessage(
              grid.Table,
              wx.grid.GRIDTABLE_NOTIFY_COLS_DELETED,
              0,
              grid.GetNumberCols() - len(v.column_names),
          )
          grid.ProcessTableMessage(tm)
          need_column_layout = True
      elif grid.GetNumberCols() < len(v.column_names):
          tm = wx.grid.GridTableMessage(
              grid.Table,
              wx.grid.GRIDTABLE_NOTIFY_COLS_INSERTED,
              0,
              len(v.column_names) - grid.GetNumberCols(),
          )
          grid.ProcessTableMessage(tm)
          need_column_layout = True
      if len(v.data) < grid.GetNumberRows():
          tm = wx.grid.GridTableMessage(
              grid.Table,
              wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED,
              0,
              grid.GetNumberRows() - len(v.data),
          )
          grid.ProcessTableMessage(tm)
      elif grid.GetNumberRows() < len(v.data):
          tm = wx.grid.GridTableMessage(
              grid.Table,
              wx.grid.GRIDTABLE_NOTIFY_ROWS_INSERTED,
              0,
              len(v.data) - grid.GetNumberRows(),
          )
          grid.ProcessTableMessage(tm)
      if need_column_layout:
          grid.AutoSizeColumns()
  
imports: import wx
  import wx.grid
  from cellprofiler_core.preferences import get_error_color
  from cellprofiler_core.setting import Table
label_desc: Use image node_id 3 for calling the TableController obj's underlying member method code with example usage: obj.update_grid() without return types