now tableview forces being a table

This commit is contained in:
Jonathan Turner 2019-06-21 19:52:15 +12:00
parent aeb0c2e7a8
commit 62310caa32

View File

@ -13,13 +13,24 @@ pub struct TableView {
}
impl TableView {
fn merge_descriptors(values: &[Value]) -> Vec<DataDescriptor> {
let mut ret = vec![];
for value in values {
for desc in value.data_descriptors() {
if !ret.contains(&desc) {
ret.push(desc);
}
}
}
ret
}
pub fn from_list(values: &[Value]) -> Option<TableView> {
if values.len() == 0 {
return None;
}
let item = &values[0];
let headers = item.data_descriptors();
let headers = TableView::merge_descriptors(values);
if headers.len() == 0 {
return None;