@@ -437,7 +437,7 @@ export async function showDataView(source: string, type: string, title: string,
437437 start,
438438 end,
439439 rows : rows as object [ ] ,
440- totalRows : totalRows ,
440+ lastRow : ( totalRows <= ( end ?? totalRows ) ? totalRows : - 1 ) ,
441441 requestId
442442 } ) ;
443443 } catch ( error ) {
@@ -600,6 +600,40 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
600600 }
601601 };
602602 const data = ${ String ( content ) } ;
603+ const displayDataSource = {
604+ rowCount: undefined,
605+ getRows(params) {
606+ const msg = {
607+ command: 'fetchRows',
608+ start: params.startRow,
609+ end: params.endRow,
610+ sortModel: params.sortModel,
611+ requestId: Math.random().toString(36).substr(2, 9) // Generate unique requestId
612+ };
613+
614+ const handler = event => {
615+ const m = event.data;
616+ if (m.command === 'fetchedRows' && m.requestId === msg.requestId) {
617+ console.log('Fetched rows:', m.rows);
618+ params.successCallback(m.rows, m.lastRow);
619+ window.removeEventListener('message', handler);
620+ }
621+ };
622+ window.addEventListener('message', handler);
623+ vscode.postMessage(msg);
624+ }
625+ };
626+ const colDefs = data.columns.map(col => {
627+ if (col.field === 'x1') {
628+ return {
629+ ...col,
630+ sortable: false,
631+ filter: false,
632+ suppressMenu: true,
633+ };
634+ }
635+ return col;
636+ });
603637 const gridOptions = {
604638 defaultColDef: {
605639 sortable: true,
@@ -612,45 +646,23 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
612646 closeOnApply: true
613647 }
614648 },
615- columnDefs: data.columns,
616- rowSelection: 'multiple',
649+ datasource: displayDataSource,
650+ getRowId: params => params.data.x1,
651+ columnDefs: colDefs,
652+ rowSelection: { mode: "multiRow", headerCheckbox: false },
617653 pagination: ${ pageSize > 0 ? 'true' : 'false' } ,
618654 paginationPageSize: ${ pageSize } ,
619655 enableCellTextSelection: true,
620656 ensureDomOrder: true,
621657 tooltipShowDelay: 100,
622658 onFirstDataRendered: onFirstDataRendered,
623659 rowModelType: 'infinite',
624- getRowNodeId: rowData => rowData.x1,
625660 cacheBlockSize: 100,
626- maxBlocksInCache: 0,
627- datasource: {
628- getRows: function(params) {
629- const msg = {
630- command: 'fetchRows',
631- start: params.startRow,
632- end: params.endRow,
633- sortModel: params.sortModel,
634- requestId: Math.random().toString(36).substr(2, 9) // Generate unique requestId
635- };
636-
637- const handler = event => {
638- const m = event.data;
639- if (
640- m.command === 'fetchedRows' &&
641- m.requestId === msg.requestId
642- ) {
643- console.log('Fetched rows:', m.rows);
644- params.successCallback(m.rows, m.totalRows);
645- window.removeEventListener('message', handler);
646- }
647- };
648- window.addEventListener('message', handler);
649- vscode.postMessage(msg);
650-
651- }
652- }
653- };
661+ maxBlocksInCache: 10,
662+ cacheOverflowSize: 2,
663+ maxConcurrentDatasourceRequests: 2,
664+ infiniteInitialRowCount: 1
665+ };
654666
655667 function onFirstDataRendered(params) {
656668 params.api.autoSizeAllColumns(false);
0 commit comments