def redraw(self):
        self.data.sort(self.sortfn)

        rows = len(self.data)
        cols = 0
        if rows > 0:
            cols = len(self.data[0])

        self.grid.resize(rows, cols)
        self.header.resize(1, cols)

        cf = self.grid.getCellFormatter()

        for (nrow, row) in enumerate(self.data):
            for (ncol, item) in enumerate(row):
                self.grid.setHTML(nrow, ncol, str(item))
                cf.setWidth(nrow, ncol, "200px")

        cf = self.header.getCellFormatter()
        self.sortbuttons = []
        for ncol in range(cols):
            sb = Button("sort col %d" % ncol)
            sb.addClickListener(self)
            self.header.setWidget(0, ncol, sb)
            cf.setWidth(0, ncol, "200px")
            self.sortbuttons.append(sb)
dataset/ETHPy150Open anandology/pyjamas/examples/funnysortedgridthing/SortedGridThing.py/OddGridWidget.redraw/original