1金币
从一个较少数据的ODataVirtualCollectionView的切换到一个较多数据的后,无法从自动发送请求导致页面空白- const oDataView = new wjcOData.ODataVirtualCollectionView(
- `/task/api/odata-report/${templateId}`,
- 'data',
- {
- oDataVersion: 4.0,
- sortOnServer: true,
- filterOnServer: true,
- groupDescriptions: cache,
- loaded: () => {
- setIsDataEmpty(oDataView.isEmpty)
- },
- },
- )
- setTemplate(template)
- setColSchemas([...settledColSchemas, ...colSchemasFromServer])
- setData(oDataView)
复制代码- useEffect(() => {
- // 每次模板变更都清除 ticketId 使详情模块隐藏
- setData(null)
- void getData()
- }, [getData])
复制代码- const onFlexGridInitialized = useCallback(
- async (flexGrid: wjcGrid.FlexGrid) => {
- setFlexGrid(flexGrid)
- // oDataVirtualCollectionView 懒加载需要在滚动时动态检测应该加载哪些数据
- flexGrid.scrollPositionChanged.addHandler(() => {
- const rng = flexGrid.viewRange
- data?.setWindow(rng.topRow, rng.bottomRow)
- })
- },
- [teaSvc, accountSvc, data, setFlexGridFilter],
- )
复制代码- <wjGrid.FlexGrid
- key={templateId}
- initialized={onFlexGridInitialized}
- itemsSource={data}
- frozenColumns={1}
- alternatingRowStep={0}
- selectionMode={'Row'}
- isReadOnly={true}
- headersVisibility={'Column'}
- allowSorting={'MultiColumn'}
- >
复制代码
|
|