@@ -621,6 +621,11 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
621621 }
622622 }
623623 };
624+ const booleanFilterParams = {
625+ filterOptions: ['equals'],
626+ defaultOption: 'equals',
627+ filterPlaceholder: '1=TRUE, 0=FALSE...'
628+ };
624629 const data = ${ String ( content ) } ;
625630 const displayDataSource = {
626631 rowCount: undefined,
@@ -665,6 +670,23 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
665670 };
666671
667672 const columnDefs = data.columns.map(col => {
673+ if (col.type === "booleanColumn") {
674+ return {
675+ ...col,
676+ valueFormatter: params =>
677+ params.value === true
678+ ? 'TRUE'
679+ : params.value === false
680+ ? 'FALSE'
681+ : ''
682+ };
683+ } else if (col.type === "dateColumn") {
684+ return {
685+ ...col,
686+ width: 200
687+ };
688+ }
689+
668690 if (col.field === "x2") {
669691 return {
670692 ...col,
@@ -676,15 +698,18 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
676698 ...col,
677699 sortable: false,
678700 filter: false,
701+ lockPosition: 'left',
679702 suppressHeaderMenuButton: true,
680- width: 60 ,
703+ width: 150 ,
681704 headerValueGetter: () => {
682705 const a = displayDataSource._TotalRows || 0;
683706 const b = displayDataSource._TotalUnfiltered || 0;
684707 return '(' + a + '/' + b + ')';
685708 }
686709 };
687710 }
711+
712+
688713 return col;
689714 });
690715
@@ -693,9 +718,11 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
693718 sortable: true,
694719 resizable: true,
695720 filter: true,
696- width: 100 ,
697- minWidth: 80 ,
721+ width: 150 ,
722+ minWidth: 100 ,
698723 floatingFilter: true,
724+ suppressHeaderMenuButton: true,
725+ lockPinned: true,
699726 filterParams: {
700727 buttons: ['apply', 'reset'],
701728 closeOnApply: true,
@@ -767,37 +794,18 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
767794
768795 document.addEventListener('DOMContentLoaded', () => {
769796 gridOptions.columnDefs.forEach(function(column) {
770- if (column.filter === 'agDateColumnFilter ') {
797+ if (column.type === 'dateColumn ') {
771798 column.filterParams = dateFilterParams;
772- }
773- else if (column.filter === 'agNumberColumnFilter') {
774- column.filterParams = {
775- filterOptions: [
776- 'equals', 'notEqual',
777- 'lessThan', 'lessThanOrEqual',
778- 'greaterThan', 'greaterThanOrEqual',
779- 'inRange', 'blank', 'notBlank'
780- ],
781- defaultOption: 'equals'
782- };
783- }
784- else if (column.filter === 'agTextColumnFilter') {
785- column.filterParams = {
786- filterOptions: [
787- 'equals', 'notEqual', 'contains', 'notContains',
788- 'startsWith', 'endsWith', 'blank', 'notBlank', 'regexp'
789- ],
790- defaultOption: 'contains'
791- };
792- }
799+ }
800+ else if (column.type == 'booleanColumn') {
801+ column.filterParams = booleanFilterParams;
802+ }
793803 });
794804
795805 const gridDiv = document.querySelector('#myGrid');
796-
797806 const gridApi = agGrid.createGrid(gridDiv, gridOptions);
798-
799- displayDataSource.api = gridApi;
800-
807+
808+ displayDataSource.api = gridApi;
801809 gridApi.setGridOption('datasource', displayDataSource);
802810
803811 });
0 commit comments