Add append() and replace() methods for core Grid class

This commit is contained in:
Lance Edgar 2018-02-02 13:16:25 -06:00
parent 1e8c9f709b
commit 97c5e97ccb

View file

@ -128,12 +128,19 @@ class Grid(object):
if key in self.columns: if key in self.columns:
self.columns.remove(key) self.columns.remove(key)
def append(self, field):
self.columns.append(field)
def insert_before(self, field, newfield): def insert_before(self, field, newfield):
self.columns.insert_before(field, newfield) self.columns.insert_before(field, newfield)
def insert_after(self, field, newfield): def insert_after(self, field, newfield):
self.columns.insert_after(field, newfield) self.columns.insert_after(field, newfield)
def replace(self, oldfield, newfield):
self.insert_after(oldfield, newfield)
self.hide_column(oldfield)
def set_joiner(self, key, joiner): def set_joiner(self, key, joiner):
if joiner is None: if joiner is None:
self.joiners.pop(key, None) self.joiners.pop(key, None)