MCPcopy Create free account
hub / github.com/bvaughn/react-virtualized / createTableInstance

Function createTableInstance

lib/components/Table/Table.tsx:111–216  ·  view source on GitHub ↗
(latest: LatestCallbacks)

Source from the content-addressed store, hash-verified

109};
110
111function createTableInstance(latest: LatestCallbacks) {
112 const internals: TableInternals = {
113 gridElement: null,
114 innerGrid: createInnerGridRef(),
115 latest
116 };
117
118 const { getGrid } = internals.innerGrid;
119
120 const handle: TableImperativeAPI = {
121 forceUpdateGrid() {
122 getGrid()?.forceUpdate();
123 },
124
125 getOffsetForRow({ align, alignment, index } = {}) {
126 const grid = getGrid();
127 if (grid) {
128 const { scrollTop } = grid.getOffsetForCell({
129 alignment: align ?? alignment,
130 rowIndex: index
131 });
132
133 return scrollTop;
134 }
135 return 0;
136 },
137
138 getScrollbarWidth() {
139 const element = internals.gridElement;
140 if (element) {
141 const clientWidth = element.clientWidth || 0;
142 const offsetWidth = element.offsetWidth || 0;
143 return offsetWidth - clientWidth;
144 }
145
146 return 0;
147 },
148
149 invalidateCellSizeAfterRender({ columnIndex, rowIndex }) {
150 internals.innerGrid.invalidateCellSizeAfterRender({
151 columnIndex,
152 rowIndex
153 });
154 },
155
156 measureAllRows() {
157 getGrid()?.measureAllCells();
158 },
159
160 recomputeGridSize({ columnIndex = 0, rowIndex = 0 } = {}) {
161 internals.innerGrid.recomputeGridSize({ columnIndex, rowIndex });
162 },
163
164 recomputeRowHeights(index = 0) {
165 internals.innerGrid.recomputeGridSize({
166 columnIndex: 0,
167 rowIndex: index
168 });

Callers 1

Table.tsxFile · 0.85

Calls 1

createInnerGridRefFunction · 0.90

Tested by

no test coverage detected