Is it possible to filter a power table using values in a hidden column?
I have the following in a custom method on a Power Table and it seems to work fine when the filter columns are not hidden in the Power Table’s Dataset:
def filterRowsByColumnValue(self, column_name): model = self.getTable().getModel().getActualModel() column_count = model.getColumnCount() i = 0 #find the index of the column by column name while i < column_count: name = model.getColumnName(i) if name == column: column_index = i break i=i+1 #remove any previous filters model.clearFilters() from com.jidesoft.grid import SingleValueFilter #create the filter class newFilter(SingleValueFilter): def isValueFiltered(self, value): if value == 0: #if this is a row that's a zero it should be filtered, so return true return True return False model.addFilter(column_index, newFilter()) model.setFiltersApplied(True) model.refresh()
However, as soon as I mark those control columns as hidden (it’s not something that I want the operators to see), the iteration of column names no longer finds an index for the column that I want to filter by.
I’m assuming that hidden columns aren’t passed into the underlying model, is that an accurate assumption, or is there a different way to get at and filter by hidden columns in the model?
Thanks in advance,