我希望我对我的问题的描述足够了..这里是:
我有一个 YUI 数据表,通过 JSON 获取服务器端记录集,然后填充数据。
用户可以单击标题对 6 列中的三列中的数据进行排序(每列都使用自定义排序功能)。排序在客户端完成。
当用户对数据进行排序时,我需要能够从显示的其中一列中获取完整的值列表。我需要所有可用的数据,而不仅仅是呈现给页面的数据。必须包括通过分页隐藏的数据。
有什么想法吗?我已经尝试了 DataTable 的 handleDataReturnPayload 和 doBeforeLoadData 方法,但它们都提供了原始的、未排序的数据。
我真的被困在这里,我有一个客户依赖于一个依赖于我获得这个排序列表的功能。
提前致谢。
最佳答案
Satyam,在 YUI Forums 完美回答了我的问题。
The data is actually stored in the RecordSet. At any time you can go and look at it, and it will be sorted as shown on the screen, but it will have all the data, whether shown or not.
Method getRecordset() will give you a reference to it and then you can loop through its records.
You can listen to the columnSortEvent to be notified a sort has occurred.
我刚刚订阅了 columnSortEvent 事件并遍历了 datatable.getRecordSet().getRecords() 返回的数组。
关于javascript - 获取完整数据集,使用带分页的 YUI 数据表排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2017389/