Closed twtyjvkg closed 4 years ago
请问具体需求是什么 ?locate逻辑是处理翻页的。
` // 查询在所有页面的对应位置 private findInAllPage(index: number): Record | undefined { const { paging } = this; let indexRecord if (paging === true ) { indexRecord = this.data[this.getIndexInCurrentPage(index)]; }else if(paging === 'server'){ indexRecord = this.treeData[this.getIndexInCurrentPage(index)]; }else{ indexRecord = this.data[index] }; return indexRecord; }
private getIndexInCurrentPage(index: number = this.currentIndex): number { const { currentPage, pageSize } = this; return index - (currentPage - 1) * pageSize; }`
如果分页了在当前的ds里面找没有就按照分页逻辑计算去请求后台找对应数据,如果想实现你那种,给page有点冲突,有些人的需求就是需要定位到,真正的第一条而不是当前页面的第一条。那如何设计成你想要的方式,所以希望你能够给一个兼容的方案设计谢谢。
能不能给locate方法加一个参数来控制这个?
能不能给locate方法加一个参数来控制这个?
具体需求是什么? 正常Table 操作选择第二页、点击第二行是不会跳到第一页的第二行。
能不能给locate方法加一个参数来控制这个?
具体需求是什么? 正常Table 操作选择第二页、点击第二行是不会跳到第一页的第二行。
好的,我看了下table的源代码,可以通过dataSet.current = record
来实现locate到当前行,谢谢!
What happens?
使用上面的方法实现点击定位到当前行始终会跳到第一页。
复现步骤,错误日志以及相关配置
预期结果
猪齿鱼UI的record的index是基于当前页的,比如我一页有10行,就是0~9,因此使用dataset.locate(1)应该是定位到当前页的第2行,而不是查询并定位到第1页的第2行。
目前我们实现定位到当前行的逻辑需要根据page和size来计算真实的index才能实现:
dataSet.locate(record?.index + dataSet.pageSize * (dataSet.currentPage - 1))
。能否修改locate的逻辑:基于当前行定位或者将计算index的逻辑加进去,或者修改record.index的取值逻辑相关环境信息