use row_nr instead of odd
This commit is contained in:
parent
4920f48ab4
commit
5de7ac0c60
1 changed files with 7 additions and 10 deletions
|
@ -137,7 +137,7 @@ impl<'a> Table<'a> {
|
||||||
layout,
|
layout,
|
||||||
widths,
|
widths,
|
||||||
striped,
|
striped,
|
||||||
odd: true,
|
row_nr: 0,
|
||||||
start_y,
|
start_y,
|
||||||
end_y,
|
end_y,
|
||||||
});
|
});
|
||||||
|
@ -149,7 +149,7 @@ pub struct TableBody<'a> {
|
||||||
layout: Layout<'a>,
|
layout: Layout<'a>,
|
||||||
widths: Vec<f32>,
|
widths: Vec<f32>,
|
||||||
striped: bool,
|
striped: bool,
|
||||||
odd: bool,
|
row_nr: usize,
|
||||||
start_y: f32,
|
start_y: f32,
|
||||||
end_y: f32,
|
end_y: f32,
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ impl<'a> TableBody<'a> {
|
||||||
TableRow {
|
TableRow {
|
||||||
layout: &mut self.layout,
|
layout: &mut self.layout,
|
||||||
widths: self.widths.clone(),
|
widths: self.widths.clone(),
|
||||||
striped: self.striped && self.odd,
|
striped: false,
|
||||||
height: skip_height,
|
height: skip_height,
|
||||||
clicked: false,
|
clicked: false,
|
||||||
}
|
}
|
||||||
|
@ -179,20 +179,17 @@ impl<'a> TableBody<'a> {
|
||||||
let count = (max_height / height).ceil() as usize;
|
let count = (max_height / height).ceil() as usize;
|
||||||
let end = cmp::min(start + count, rows);
|
let end = cmp::min(start + count, rows);
|
||||||
|
|
||||||
self.odd = start % 2 == 0;
|
|
||||||
|
|
||||||
for idx in start..end {
|
for idx in start..end {
|
||||||
row(
|
row(
|
||||||
idx,
|
idx,
|
||||||
TableRow {
|
TableRow {
|
||||||
layout: &mut self.layout,
|
layout: &mut self.layout,
|
||||||
widths: self.widths.clone(),
|
widths: self.widths.clone(),
|
||||||
striped: self.striped && self.odd,
|
striped: self.striped && idx % 2 == 0,
|
||||||
height,
|
height,
|
||||||
clicked: false,
|
clicked: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
self.odd = !self.odd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if rows - end > 0 {
|
if rows - end > 0 {
|
||||||
|
@ -201,7 +198,7 @@ impl<'a> TableBody<'a> {
|
||||||
TableRow {
|
TableRow {
|
||||||
layout: &mut self.layout,
|
layout: &mut self.layout,
|
||||||
widths: self.widths.clone(),
|
widths: self.widths.clone(),
|
||||||
striped: self.striped && self.odd,
|
striped: false,
|
||||||
height: skip_height,
|
height: skip_height,
|
||||||
clicked: false,
|
clicked: false,
|
||||||
}
|
}
|
||||||
|
@ -214,12 +211,12 @@ impl<'a> TableBody<'a> {
|
||||||
row(TableRow {
|
row(TableRow {
|
||||||
layout: &mut self.layout,
|
layout: &mut self.layout,
|
||||||
widths: self.widths.clone(),
|
widths: self.widths.clone(),
|
||||||
striped: self.striped && self.odd,
|
striped: self.striped && self.row_nr % 2 == 0,
|
||||||
height,
|
height,
|
||||||
clicked: false,
|
clicked: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
self.odd = !self.odd;
|
self.row_nr += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue