Skip to content

Commit ad8969c

Browse files
committed
F/FB/B buttons switch bom tables too
Fixes #7
1 parent 9cbef3f commit ad8969c

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

InteractiveHtmlBom/ibom.html

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
width: 15%;
153153
}
154154

155-
.bom .Quantity-Per-PCB {
155+
.bom .Quantity {
156156
width: 65px;
157157
}
158158

@@ -604,13 +604,25 @@
604604
return r;
605605
}
606606

607-
function populateBomTable() {
607+
function populateBomTable(layout) {
608+
console.log('populate bom called with ' + layout);
608609
while (bom.firstChild) {
609610
bom.removeChild(bom.firstChild);
610611
}
611612
var first = true;
612-
for (i in pcbdata.bom.both) {
613-
var bomentry = pcbdata.bom.both[i];
613+
switch (layout) {
614+
case 'F':
615+
bomtable = pcbdata.bom.F;
616+
break;
617+
case 'FB':
618+
bomtable = pcbdata.bom.both;
619+
break;
620+
case 'B':
621+
bomtable = pcbdata.bom.B;
622+
break;
623+
}
624+
for (i in bomtable) {
625+
var bomentry = bomtable[i];
614626
if (filter && !entryMatches(bomentry)) {
615627
continue;
616628
}
@@ -654,7 +666,7 @@
654666

655667
function updateFilter(input) {
656668
filter = input.toLowerCase();
657-
populateBomTable();
669+
populateBomTable(canvaslayout);
658670
}
659671

660672
function silkscreenVisible(visible) {
@@ -692,6 +704,7 @@
692704
}
693705
canvaslayout = layout;
694706
resizeCanvas();
707+
populateBomTable(layout);
695708
}
696709

697710
function populateMetadata() {
@@ -804,13 +817,12 @@
804817
dbgdiv = document.getElementById("dbg");
805818
bom = document.getElementById("bombody");
806819
bomlayout = "none";
807-
changeBomLayout('LR');
808-
changeCanvasLayout("FB");
809-
console.log("document.onload", e, Date.now());
810-
resizeCanvas();
820+
canvaslayout = "FB";
811821
filter = "";
812822
populateMetadata();
813-
populateBomTable();
823+
resizeCanvas();
824+
changeBomLayout('LR');
825+
console.log("document.onload", e, Date.now());
814826
}
815827

816828
window.onresize = resizeCanvas;
@@ -886,7 +898,7 @@
886898
<th class="References">References</th>
887899
<th class="Value">Value</th>
888900
<th class="Footprint">Footprint</th>
889-
<th class="Quantity-Per-PCB">Quantity Per PCB</th>
901+
<th class="Quantity">Quantity</th>
890902
</tr>
891903
</thead>
892904
<tbody id="bombody">

0 commit comments

Comments
 (0)