获取完整数据集,并使用 YUI 数据表和分页进行排序

发布于 2024-08-17 00:49:41 字数 375 浏览 3 评论 0原文

我希望我已经足够描述我的问题了..这里是:

我有一个 YUI 数据表,通过 JSON 获取服务器端记录集,然后填充数据。

用户可以单击标题对 6 列中的三列中的数据进行排序(每列使用自定义排序功能)。排序是在客户端完成的。

当用户对数据进行排序时,我需要能够从显示的一列中获取完整的值列表。我需要所有可用的数据,而不仅仅是呈现到页面的数据。必须包括通过分页隐藏的数据。

有什么想法吗?我尝试过 DataTable 的 handleDataReturnPayload 和 doBeforeLoadData 方法,但两者都提供原始的、未排序的数据。

我真的被困在这里,我有一个客户依赖于一个功能,而这个功能取决于我获取这个排序列表。

提前致谢。

I hope I am describing my issue enough.. here goes:

I have a YUI data table, get a server side set of records via JSON, and then populates the data.

Users can click on the headers to sort the data in three of the 6 columns, (which are using a custom sort function for each column). The sorting is done client-side.

When a user sorts the data, I need to be able to get a complete list of the values from one of the columns being shown. I need all the data available, not just what's rendered to the page. The data hidden via pagination must be included.

Any ideas? I've tried the handleDataReturnPayload and doBeforeLoadData methods of the DataTable but both give the original, unsorted data.

I'm really stuck here and I've got a client depending on a feature that depends on me getting this sorted list.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

别在捏我脸啦 2024-08-24 00:49:41

Satyam,在 YUI 论坛完美地回答了我的问题

数据实际上存储在
记录集。任何时候你都可以去
看看它,它会被排序为
显示在屏幕上,但它会有
所有数据,无论是否显示。

方法 getRecordset() 会给你一个
引用它然后你可以循环
通过其记录。

您可以监听columnSortEvent
收到排序已发生的通知。

我刚刚订阅了 columnSortEvent 事件并循环访问 datatable.getRecordSet().getRecords() 返回的数组。

Satyam, over at the YUI Forums answered my question perfectly.

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.

I just subscribed to the columnSortEvent event and looped through the array returned by datatable.getRecordSet().getRecords().

我不咬妳我踢妳 2024-08-24 00:49:41

我建议将其发布到 YUI 论坛 - http://yuilibrary.com/forum/ - - 这是获得数据表问题支持的好地方。

I'd recommend posting this to the YUI forums -- http://yuilibrary.com/forum/ -- that's a great place to get support on DataTable issues.

她说她爱他 2024-08-24 00:49:41

我偶然发现这个问题,寻找有关如何从数据表中未显示的数据集中检索信息的信息。如果您将数据源中的隐藏数据放置在您希望显示的任何字段之前,它将呈现为空白,但如果您将其放置在将呈现的最后一个字段之后(由 columns 对象定义),那么它们将不会渲染但仍可通过记录访问)。

var columns = [
    {key:"Whatchamacallits", children:[
        {key:"name" },
        {key:"price" }
    ]}
];
var ds = new YAHOO.util.DataSource('index.php...');
oDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
oDataSource.responseSchema = {
    fields:["name","price","id"]
};
var dt = new YAHOO.widget.DataTable("dt-id", columns, ds, {});
dt.subscribe("rowClickEvent", dt.onEventSelectRow);
dt.subscribe("rowSelectEvent", function(p){ alert(p.getData('id'); });

I stumbled upon this question looking for information on how to retrieve information from a dataset that was NOT displayed in the datatable. IF you place the hidden data in the datasource before any field you wish to be displayed, it will be rendered blank, but if you place it after your last field that will be rendered (as defined by the columns object), then they will not render but still be accessible through the record).

var columns = [
    {key:"Whatchamacallits", children:[
        {key:"name" },
        {key:"price" }
    ]}
];
var ds = new YAHOO.util.DataSource('index.php...');
oDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
oDataSource.responseSchema = {
    fields:["name","price","id"]
};
var dt = new YAHOO.widget.DataTable("dt-id", columns, ds, {});
dt.subscribe("rowClickEvent", dt.onEventSelectRow);
dt.subscribe("rowSelectEvent", function(p){ alert(p.getData('id'); });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文